diff --git a/Gruntfile.js b/Gruntfile.js index 21ea74bb3..898d9640a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,8 +11,9 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-execute'); - grunt.registerTask('default', ['peg', 'amberc:all']); - grunt.registerTask('amberc:all', ['amberc:amber', 'amberc:cli', 'amberc:dev']); + grunt.registerTask('default', ['peg', 'build:all']); + grunt.registerTask('build:all', ['amberc:amber', 'build:cli', 'amberc:dev']); + grunt.registerTask('build:cli', ['amberc:cli', 'requirejs:cli']); grunt.registerTask('test', ['amdconfig:amber', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']); grunt.registerTask('devel', ['amdconfig:amber']); @@ -62,8 +63,6 @@ module.exports = function (grunt) { 'SUnit', 'Platform-ImportExport', 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests' ], - main_class: 'AmberCli', - output_name: '../support/amber-cli', amd_namespace: 'amber_cli' }, dev: { @@ -74,6 +73,26 @@ module.exports = function (grunt) { }, requirejs: { + cli: { + options: { + mainConfigFile: "config.js", + rawText: { + "app": "(" + function () { + define(["amber/devel", "amber_cli/AmberCli"], function (amber) { + amber.initialize(); + amber.globals.AmberCli._main(); + }); + } + "());" + }, + pragmas: { + // none, for repl to have all info + }, + include: ['config-node', 'app'], + optimize: "none", + wrap: helpers.nodeWrap('app'), + out: "external/amber-cli/support/amber-cli.js" + } + }, test_runner: { options: { mainConfigFile: "config.js", diff --git a/external/amber-cli/support/amber-cli.js b/external/amber-cli/support/amber-cli.js index 027fcfbd9..e338cd238 100644 --- a/external/amber-cli/support/amber-cli.js +++ b/external/amber-cli/support/amber-cli.js @@ -1,282 +1,18 @@ #!/usr/bin/env node -var define = (function amdefine(module, requireFn) { - 'use strict'; - var defineCache = {}, - loaderCache = {}, - alreadyCalled = false, - path = require('path'), - makeRequire, stringRequire; +(function(define, require){ +define("_wrap_app", function (requirejs) { +requirejs.resolve = require.resolve; +require = requirejs; +// This file is used to make additional changes +// when building an app to run in node.js. +// Free to edit. You can break tests (cli test runner uses +// this to build itself - it is a node executable). +define("amber_core/Platform-Browser", ["amber_core/Platform-Node"], {}); +define("amber/browser-compatibility", {}); +define("jquery", {}); + +define("config-node", function(){}); - /** - * Trims the . and .. from an array of path segments. - * It will keep a leading path segment if a .. will become - * the first path segment, to help with module name lookups, - * which act like paths, but can be remapped. But the end result, - * all paths that use this function should look normalized. - * NOTE: this method MODIFIES the input array. - * @param {Array} ary the array of path segments. - */ - function trimDots(ary) { - var i, part; - for (i = 0; ary[i]; i+= 1) { - part = ary[i]; - if (part === '.') { - ary.splice(i, 1); - i -= 1; - } else if (part === '..') { - if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - break; - } else if (i > 0) { - ary.splice(i - 1, 2); - i -= 2; - } - } - } - } - - function normalize(name, baseName) { - var baseParts; - - //Adjust any relative paths. - if (name && name.charAt(0) === '.') { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - baseParts = baseName.split('/'); - baseParts = baseParts.slice(0, baseParts.length - 1); - baseParts = baseParts.concat(name.split('/')); - trimDots(baseParts); - name = baseParts.join('/'); - } - } - - return name; - } - - /** - * Create the normalize() function passed to a loader plugin's - * normalize method. - */ - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(id) { - function load(value) { - loaderCache[id] = value; - } - - load.fromText = function (id, text) { - //This one is difficult because the text can/probably uses - //define, and any relative paths and requires should be relative - //to that id was it would be found on disk. But this would require - //bootstrapping a module/require fairly deeply from node core. - //Not sure how best to go about that yet. - throw new Error('amdefine does not implement load.fromText'); - }; - - return load; - } - - makeRequire = function (systemRequire, exports, module, relId) { - function amdRequire(deps, callback) { - if (typeof deps === 'string') { - //Synchronous, single module require('') - return stringRequire(systemRequire, exports, module, deps, relId); - } else { - //Array of dependencies with a callback. - - //Convert the dependencies to modules. - deps = deps.map(function (depName) { - return stringRequire(systemRequire, exports, module, depName, relId); - }); - - //Wait for next tick to call back the require call. - process.nextTick(function () { - callback.apply(null, deps); - }); - } - } - - amdRequire.toUrl = function (filePath) { - if (filePath.indexOf('.') === 0) { - return normalize(filePath, path.dirname(module.filename)); - } else { - return filePath; - } - }; - - return amdRequire; - }; - - //Favor explicit value, passed in if the module wants to support Node 0.4. - requireFn = requireFn || function req() { - return module.require.apply(module, arguments); - }; - - function runFactory(id, deps, factory) { - var r, e, m, result; - - if (id) { - e = loaderCache[id] = {}; - m = { - id: id, - uri: __filename, - exports: e - }; - r = makeRequire(requireFn, e, m, id); - } else { - //Only support one define call per file - if (alreadyCalled) { - throw new Error('amdefine with no module ID cannot be called more than once per file.'); - } - alreadyCalled = true; - - //Use the real variables from node - //Use module.exports for exports, since - //the exports in here is amdefine exports. - e = module.exports; - m = module; - r = makeRequire(requireFn, e, m, module.id); - } - - //If there are dependencies, they are strings, so need - //to convert them to dependency values. - if (deps) { - deps = deps.map(function (depName) { - return r(depName); - }); - } - - //Call the factory with the right dependencies. - if (typeof factory === 'function') { - result = factory.apply(m.exports, deps); - } else { - result = factory; - } - - if (result !== undefined) { - m.exports = result; - if (id) { - loaderCache[id] = m.exports; - } - } - } - - stringRequire = function (systemRequire, exports, module, id, relId) { - //Split the ID by a ! so that - var index = id.indexOf('!'), - originalId = id, - prefix, plugin; - - if (index === -1) { - id = normalize(id, relId); - - //Straight module lookup. If it is one of the special dependencies, - //deal with it, otherwise, delegate to node. - if (id === 'require') { - return makeRequire(systemRequire, exports, module, relId); - } else if (id === 'exports') { - return exports; - } else if (id === 'module') { - return module; - } else if (loaderCache.hasOwnProperty(id)) { - return loaderCache[id]; - } else if (defineCache[id]) { - runFactory.apply(null, defineCache[id]); - return loaderCache[id]; - } else { - if(systemRequire) { - return systemRequire(originalId); - } else { - throw new Error('No module with ID: ' + id); - } - } - } else { - //There is a plugin in play. - prefix = id.substring(0, index); - id = id.substring(index + 1, id.length); - - plugin = stringRequire(systemRequire, exports, module, prefix, relId); - - if (plugin.normalize) { - id = plugin.normalize(id, makeNormalize(relId)); - } else { - //Normalize the ID normally. - id = normalize(id, relId); - } - - if (loaderCache[id]) { - return loaderCache[id]; - } else { - plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {}); - - return loaderCache[id]; - } - } - }; - - //Create a define function specific to the module asking for amdefine. - function define(id, deps, factory) { - if (Array.isArray(id)) { - factory = deps; - deps = id; - id = undefined; - } else if (typeof id !== 'string') { - factory = id; - id = deps = undefined; - } - - if (deps && !Array.isArray(deps)) { - factory = deps; - deps = undefined; - } - - if (!deps) { - deps = ['require', 'exports', 'module']; - } - - //Set up properties for this module. If an ID, then use - //internal cache. If no ID, then use the external variables - //for this node module. - if (id) { - //Put the module in deep freeze until there is a - //require call for it. - defineCache[id] = [id, deps, factory]; - } else { - runFactory(id, deps, factory); - } - } - - //define.require, which has access to all the values in the - //cache. Useful for AMD modules that all have IDs in the file, - //but need to finally export a value to node based on one of those - //IDs. - define.require = function (id) { - if (loaderCache[id]) { - return loaderCache[id]; - } - - if (defineCache[id]) { - runFactory.apply(null, defineCache[id]); - return loaderCache[id]; - } - }; - - define.amd = {}; - - return define; -})(null, function (id) { console.log("Skipping dependency: " + id); }), requirejs = define.require; -define("amber/browser-compatibility", [], {}); /* ==================================================================== | | Amber Smalltalk @@ -1416,6 +1152,76 @@ define("amber/boot", [ 'require', './browser-compatibility' ], function (require return { api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver }; }); +define("amber/helpers", ["amber/boot", "require"], function (boot, require) { + var globals = boot.globals, + exports = {}, + api = boot.api, + nil = boot.nil; + + // API + + exports.popupHelios = function () { + require(['helios/index'], function (helios) { + helios.popup(); + }, function (err) { + window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err); + }); + }; + Object.defineProperty(exports, "api", { + value: api, + enumerable: true, configurable: true, writable: false + }); + Object.defineProperty(exports, "globals", { + value: globals, + enumerable: true, configurable: true, writable: false + }); + Object.defineProperty(exports, "nil", { + value: nil, + enumerable: true, configurable: true, writable: false + }); + + function mixinToSettings(source) { + var settings = globals.SmalltalkSettings; + Object.keys(source).forEach(function (key) { + settings[key] = source[key]; + }); + } + + function settingsInLocalStorage() { + //jshint evil:true + var global = new Function('return this')(), + storage = 'localStorage' in global && global.localStorage; + + if (storage) { + var fromStorage; + try { + fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings')); + } catch (ex) { + // pass + } + mixinToSettings(fromStorage || {}); + if (typeof window !== "undefined") { + requirejs(['jquery'], function ($) { + $(window).on('beforeunload', function () { + storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings)); + }); + }); + } + } + } + + exports.initialize = function (options) { + globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace; + settingsInLocalStorage(); + mixinToSettings(options || {}); + return api.initialize(); + }; + + // Exports + + return exports; +}); + define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){ var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage('Kernel-Objects'); @@ -1423,30 +1229,22 @@ $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr) $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('ProtoObject', null, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: 'comparing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__eq_eq(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "= anObject\x0a\x09^ self == anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=="] }), $globals.ProtoObject); @@ -1457,26 +1255,15 @@ selector: "==", protocol: 'comparing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq($recv(anObject)._identityHash()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject); +return self; }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], -source: "== anObject\x0a\x09^ self identityHash = anObject identityHash", +source: "== anObject\x0a", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["=", "identityHash"] +messageSends: [] }), $globals.ProtoObject); @@ -1486,21 +1273,15 @@ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._printString(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09^ self printString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printString"] }), $globals.ProtoObject); @@ -1511,20 +1292,14 @@ selector: "class", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.klass; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "class\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1536,24 +1311,18 @@ protocol: 'error handling', fn: function (aMessage){ var self=this; function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv($MessageNotUnderstood())._new(); $recv($1)._receiver_(self); $recv($1)._message_(aMessage); $2=$recv($1)._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMessage"], source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal", referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); messageSends: ["receiver:", "new", "message:", "signal"] }), $globals.ProtoObject); @@ -1564,21 +1333,15 @@ selector: "evaluate:on:", protocol: 'evaluating', fn: function (aString,anEvaluator){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(anEvaluator)._evaluate_receiver_(aString,self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anEvaluator"], source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["evaluate:receiver:"] }), $globals.ProtoObject); @@ -1589,9 +1352,7 @@ selector: "identityHash", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var hash=self.identityHash; if (hash) return hash; @@ -1600,15 +1361,11 @@ return $core.withContext(function($ctx1) { return hash; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1622,11 +1379,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1637,21 +1392,15 @@ selector: "ifNil:ifNotNil:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(anotherBlock)._value_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.ProtoObject); @@ -1662,21 +1411,15 @@ selector: "ifNotNil:", protocol: 'testing', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(aBlock)._value_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.ProtoObject); @@ -1687,21 +1430,15 @@ selector: "ifNotNil:ifNil:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(aBlock)._value_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.ProtoObject); @@ -1715,11 +1452,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1731,20 +1466,14 @@ protocol: 'inspecting', fn: function (){ var self=this; function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Inspector())._inspect_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "inspect\x0a\x09Inspector inspect: self", referencedClasses: ["Inspector"], -//>>excludeEnd("ide"); messageSends: ["inspect:"] }), $globals.ProtoObject); @@ -1758,11 +1487,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInspector"], source: "inspectOn: anInspector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1773,20 +1500,14 @@ selector: "instVarAt:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self['@'+aString] ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "instVarAt: aString\x0a\x09< return self['@'+aString] >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1797,20 +1518,14 @@ selector: "instVarAt:put:", protocol: 'accessing', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self['@' + aString] = anObject ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1821,9 +1536,7 @@ selector: "isKindOf:", protocol: 'testing', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._isMemberOf_(aClass); if($core.assert($2)){ @@ -1832,15 +1545,11 @@ $1=true; $1=$recv(self._class())._inheritsFrom_(aClass); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"] }), $globals.ProtoObject); @@ -1854,36 +1563,49 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isNil\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); +$core.addMethod( +$core.method({ +selector: "isSameInstanceAs:", +protocol: 'comparing', +fn: function (anObject){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._identityHash(); +$ctx1.sendIdx["identityHash"]=1; +$1=$recv($2).__eq($recv(anObject)._identityHash()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)}); +}, +args: ["anObject"], +source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash", +referencedClasses: [], +messageSends: ["=", "identityHash"] +}), +$globals.ProtoObject); + $core.addMethod( $core.method({ selector: "notNil", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._isNil())._not(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "notNil\x0a\x09^ self isNil not", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["not", "isNil"] }), $globals.ProtoObject); @@ -1894,21 +1616,15 @@ selector: "perform:", protocol: 'message handling', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._perform_withArguments_(aString,[]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["perform:withArguments:"] }), $globals.ProtoObject); @@ -1919,20 +1635,14 @@ selector: "perform:withArguments:", protocol: 'message handling', fn: function (aString,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.send(self, aString._asJavaScriptMethodName(), aCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aCollection"], source: "perform: aString withArguments: aCollection\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -1943,18 +1653,12 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $5,$4,$3,$2,$1; $5=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $3=$recv($4)._first(); $2=$recv($3)._isVowel(); if($core.assert($2)){ @@ -1963,20 +1667,14 @@ $1="an "; $1="a "; }; $recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_($recv(self._class())._name()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"] }), $globals.ProtoObject); @@ -1988,29 +1686,19 @@ protocol: 'printing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($String())._streamContents_((function(str){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._printOn_(str); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "printOn:"] }), $globals.ProtoObject); @@ -2024,11 +1712,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "yourself\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject); @@ -2039,24 +1725,16 @@ selector: "~=", protocol: 'comparing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self.__eq(anObject)).__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "~= anObject\x0a\x09^ (self = anObject) = false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["="] }), $globals.ProtoObject); @@ -2067,21 +1745,15 @@ selector: "~~", protocol: 'comparing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self.__eq_eq(anObject)).__eq(false); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "~~ anObject\x0a\x09^ (self == anObject) = false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=", "=="] }), $globals.ProtoObject); @@ -2096,20 +1768,16 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtoObject.klass); $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "->", @@ -2117,21 +1785,15 @@ protocol: 'converting', fn: function (anObject){ var self=this; function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Association())._key_value_(self,anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "-> anObject\x0a\x09^ Association key: self value: anObject", referencedClasses: ["Association"], -//>>excludeEnd("ide"); messageSends: ["key:value:"] }), $globals.Object); @@ -2144,31 +1806,21 @@ fn: function (){ var self=this; var variables; function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; variables=$recv($HashedCollection())._new(); $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=variables; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables", referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"] }), $globals.Object); @@ -2180,21 +1832,15 @@ protocol: 'converting', fn: function (){ var self=this; function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($JSON())._stringify_(self._asJSON()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSONString\x0a\x09^ JSON stringify: self asJSON", referencedClasses: ["JSON"], -//>>excludeEnd("ide"); messageSends: ["stringify:", "asJSON"] }), $globals.Object); @@ -2205,21 +1851,15 @@ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._asString(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09^ self asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asString"] }), $globals.Object); @@ -2230,20 +1870,14 @@ selector: "basicAt:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self[aString]; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basicAt: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2254,20 +1888,14 @@ selector: "basicAt:put:", protocol: 'accessing', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self[aString] = anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "basicAt: aString put: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2278,20 +1906,14 @@ selector: "basicDelete:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); delete self[aString]; return aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basicDelete: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2302,21 +1924,15 @@ selector: "basicPerform:", protocol: 'message handling', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicPerform_withArguments_(aString,[]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicPerform:withArguments:"] }), $globals.Object); @@ -2327,20 +1943,14 @@ selector: "basicPerform:withArguments:", protocol: 'message handling', fn: function (aString,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self[aString].apply(self, aCollection);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aCollection"], source: "basicPerform: aString withArguments: aCollection\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2352,20 +1962,14 @@ protocol: 'browsing', fn: function (){ var self=this; function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Finder())._findClass_(self._class()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "browse\x0a\x09Finder findClass: self class", referencedClasses: ["Finder"], -//>>excludeEnd("ide"); messageSends: ["findClass:", "class"] }), $globals.Object); @@ -2376,21 +1980,15 @@ selector: "copy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._shallowCopy())._postCopy(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "copy\x0a\x09^ self shallowCopy postCopy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["postCopy", "shallowCopy"] }), $globals.Object); @@ -2401,9 +1999,7 @@ selector: "deepCopy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var copy = self.klass._new(); Object.keys(self).forEach(function (i) { @@ -2414,15 +2010,11 @@ return $core.withContext(function($ctx1) { return copy; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2433,44 +2025,28 @@ selector: "deprecatedAPI", protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$6,$5,$4,$8,$7,$3,$2; $1=console; $6=$core.getThisContext()._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=1; -//>>excludeEnd("ctx"); $5=$recv($6)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asString"]=1; -//>>excludeEnd("ctx"); $4=$recv($5).__comma(" is deprecated! (in "); $8=$recv($core.getThisContext()._home())._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=2; -//>>excludeEnd("ctx"); $7=$recv($8)._asString(); $3=$recv($4).__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($1)._warn_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["warn:", ",", "asString", "home"] }), $globals.Object); @@ -2481,48 +2057,30 @@ selector: "deprecatedAPI:", protocol: 'error handling', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$6,$5,$4,$8,$7,$3,$2; $1=console; $6=$core.getThisContext()._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=1; -//>>excludeEnd("ctx"); $5=$recv($6)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asString"]=1; -//>>excludeEnd("ctx"); $4=$recv($5).__comma(" is deprecated! (in "); $8=$recv($core.getThisContext()._home())._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=2; -//>>excludeEnd("ctx"); $7=$recv($8)._asString(); $3=$recv($4).__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($1)._warn_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["warn:"]=1; -//>>excludeEnd("ctx"); $recv(console)._warn_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["warn:", ",", "asString", "home"] }), $globals.Object); @@ -2534,20 +2092,14 @@ protocol: 'error handling', fn: function (aString){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Error())._signal_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "error: aString\x0a\x09Error signal: aString", referencedClasses: ["Error"], -//>>excludeEnd("ide"); messageSends: ["signal:"] }), $globals.Object); @@ -2559,63 +2111,34 @@ protocol: 'error handling', fn: function (){ var self=this; function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Halt())._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "halt\x0a\x09Halt signal", referencedClasses: ["Halt"], -//>>excludeEnd("ide"); messageSends: ["signal"] }), $globals.Object); $core.addMethod( $core.method({ -selector: "inspectOn:", -protocol: 'inspecting', -fn: function (anInspector){ +selector: "in:", +protocol: 'evaluating', +fn: function (aValuable){ var self=this; -var variables; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -variables=$recv($Dictionary())._new(); -$recv(variables)._at_put_("#self",self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(variables)._at_put_(each,self._instVarAt_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv(anInspector)._setLabel_(self._printString()); -$1=$recv(anInspector)._setVariables_(variables); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)}); -//>>excludeEnd("ctx"); +$1=$recv(aValuable)._value_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInspector"], -source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"] +args: ["aValuable"], +source: "in: aValuable\x0a\x09^ aValuable value: self", +referencedClasses: [], +messageSends: ["value:"] }), $globals.Object); @@ -2628,11 +2151,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBehavior\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2646,11 +2167,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBoolean\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2664,11 +2183,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isClass\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2682,11 +2199,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isCompiledMethod\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2700,11 +2215,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2715,21 +2228,15 @@ selector: "isMemberOf:", protocol: 'testing', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class()).__eq(aClass); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "isMemberOf: aClass\x0a\x09^ self class = aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=", "class"] }), $globals.Object); @@ -2743,11 +2250,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isMetaclass\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2761,11 +2266,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isNumber\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2779,11 +2282,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isPackage\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2797,11 +2298,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isParseFailure\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2815,11 +2314,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isString\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2833,11 +2330,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSymbol\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2851,11 +2346,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "postCopy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2866,20 +2359,14 @@ selector: "putOn:", protocol: 'streaming', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPut_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "putOn: aStream\x0a\x09aStream nextPut: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPut:"] }), $globals.Object); @@ -2890,21 +2377,15 @@ selector: "respondsTo:", protocol: 'testing', fn: function (aSelector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._canUnderstand_(aSelector); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aSelector"], source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["canUnderstand:", "class"] }), $globals.Object); @@ -2915,9 +2396,7 @@ selector: "shallowCopy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var copy = self.klass._new(); Object.keys(self).forEach(function(i) { @@ -2928,15 +2407,11 @@ return $core.withContext(function($ctx1) { return copy; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -2947,20 +2422,14 @@ selector: "shouldNotImplement", protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("This method should not be implemented in ".__comma($recv(self._class())._name())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:", ",", "name", "class"] }), $globals.Object); @@ -2971,20 +2440,14 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("Object not indexable"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09self error: 'Object not indexable'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:"] }), $globals.Object); @@ -2995,20 +2458,14 @@ selector: "subclassResponsibility", protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("This method is a responsibility of a subclass"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:"] }), $globals.Object); @@ -3019,20 +2476,14 @@ selector: "throw:", protocol: 'error handling', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); throw anObject ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "throw: anObject\x0a\x09< throw anObject >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -3040,23 +2491,17 @@ $globals.Object); $core.addMethod( $core.method({ selector: "value", -protocol: 'accessing', +protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.valueOf(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object); @@ -3068,20 +2513,14 @@ selector: "accessorProtocolWith:", protocol: 'helios', fn: function (aGenerator){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aGenerator)._accessorProtocolForObject(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aGenerator"], source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["accessorProtocolForObject"] }), $globals.Object.klass); @@ -3092,20 +2531,14 @@ selector: "accessorsSourceCodesWith:", protocol: 'helios', fn: function (aGenerator){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aGenerator)._accessorsForObject(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aGenerator"], source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["accessorsForObject"] }), $globals.Object.klass); @@ -3119,11 +2552,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09\x22no op\x22", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Object.klass); @@ -3134,20 +2565,14 @@ selector: "initializeProtocolWith:", protocol: 'helios', fn: function (aGenerator){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aGenerator)._initializeProtocolForObject(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aGenerator"], source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initializeProtocolForObject"] }), $globals.Object.klass); @@ -3158,38 +2583,28 @@ selector: "initializeSourceCodesWith:", protocol: 'helios', fn: function (aGenerator){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aGenerator)._initializeForObject(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aGenerator"], source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initializeForObject"] }), $globals.Object.klass); $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "&", protocol: 'controlling', fn: function (aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self == true) { return aBoolean; @@ -3198,44 +2613,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBoolean"], source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Boolean); - -$core.addMethod( -$core.method({ -selector: "=", -protocol: 'comparing', -fn: function (aBoolean){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); - - return aBoolean != null && - typeof aBoolean._isBoolean === "function" && - aBoolean._isBoolean() && - Boolean(self == true) == aBoolean - ; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},$globals.Boolean)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "= aBoolean\x0a\x09<\x0a\x09\x09return aBoolean != null &&\x0a\x09\x09\x09typeof aBoolean._isBoolean === \x22function\x22 &&\x0a\x09\x09\x09aBoolean._isBoolean() &&\x0a\x09\x09\x09Boolean(self == true) == aBoolean\x0a\x09>", -referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3246,22 +2628,15 @@ selector: "==", protocol: 'comparing', fn: function (aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self.__eq(aBoolean); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf()); +return self; }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBoolean"], -source: "== aBoolean\x0a\x09^ self = aBoolean", +source: "== aBoolean\x0a", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["="] +messageSends: [] }), $globals.Boolean); @@ -3271,9 +2646,7 @@ selector: "and:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self.__eq(true); $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){ @@ -3281,15 +2654,11 @@ return false; })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "="] }), $globals.Boolean); @@ -3300,9 +2669,7 @@ selector: "asBit", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; if($core.assert(self)){ $1=(1); @@ -3310,15 +2677,11 @@ $1=(1); $1=(0); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:"] }), $globals.Boolean); @@ -3332,11 +2695,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3347,20 +2708,14 @@ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toString() ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09< return self.toString() >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3374,11 +2729,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3389,23 +2742,17 @@ selector: "ifFalse:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._ifTrue_ifFalse_((function(){ }),aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:"] }), $globals.Boolean); @@ -3416,21 +2763,15 @@ selector: "ifFalse:ifTrue:", protocol: 'controlling', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._ifTrue_ifFalse_(anotherBlock,aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:"] }), $globals.Boolean); @@ -3441,23 +2782,17 @@ selector: "ifTrue:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._ifTrue_ifFalse_(aBlock,(function(){ })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:"] }), $globals.Boolean); @@ -3468,9 +2803,7 @@ selector: "ifTrue:ifFalse:", protocol: 'controlling', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self == true) { return aBlock._value(); @@ -3479,15 +2812,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3501,11 +2830,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBoolean\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3519,11 +2846,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3534,21 +2859,15 @@ selector: "not", protocol: 'controlling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__eq(false); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "not\x0a\x09^ self = false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["="] }), $globals.Boolean); @@ -3559,9 +2878,7 @@ selector: "or:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self.__eq(true); $1=$recv($2)._ifTrue_ifFalse_((function(){ @@ -3569,15 +2886,11 @@ return true; }),aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "="] }), $globals.Boolean); @@ -3588,20 +2901,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._asString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "asString"] }), $globals.Boolean); @@ -3615,11 +2922,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3630,9 +2935,7 @@ selector: "|", protocol: 'controlling', fn: function (aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self == true) { return true; @@ -3641,15 +2944,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBoolean"], source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Boolean); @@ -3657,29 +2956,21 @@ $globals.Boolean); $core.addClass('Date', $globals.Object, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "+", protocol: 'arithmetic', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self + aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: "+ aDate\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3690,20 +2981,14 @@ selector: "-", protocol: 'arithmetic', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self - aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: "- aDate\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3714,20 +2999,14 @@ selector: "<", protocol: 'comparing', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self < aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: "< aDate\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3738,20 +3017,14 @@ selector: "<=", protocol: 'comparing', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self <= aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: "<= aDate\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3762,20 +3035,14 @@ selector: ">", protocol: 'comparing', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self > aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: "> aDate\x0a\x09> aDate>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3786,20 +3053,14 @@ selector: ">=", protocol: 'comparing', fn: function (aDate){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self >= aDate; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDate"], source: ">= aDate\x0a\x09>= aDate>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3810,20 +3071,14 @@ selector: "asDateString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toDateString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asDateString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3834,20 +3089,14 @@ selector: "asLocaleString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toLocaleString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asLocaleString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3858,21 +3107,15 @@ selector: "asMilliseconds", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._time(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asMilliseconds\x0a\x09^ self time", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["time"] }), $globals.Date); @@ -3883,21 +3126,15 @@ selector: "asNumber", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._asMilliseconds(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asNumber\x0a\x09^ self asMilliseconds", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asMilliseconds"] }), $globals.Date); @@ -3908,20 +3145,14 @@ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3932,20 +3163,14 @@ selector: "asTimeString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toTimeString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asTimeString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -3956,21 +3181,15 @@ selector: "day", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._dayOfWeek(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "day\x0a\x09^ self dayOfWeek", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["dayOfWeek"] }), $globals.Date); @@ -3981,20 +3200,14 @@ selector: "day:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._dayOfWeek_(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "day: aNumber\x0a\x09self dayOfWeek: aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["dayOfWeek:"] }), $globals.Date); @@ -4005,20 +3218,14 @@ selector: "dayOfMonth", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getDate(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "dayOfMonth\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4029,20 +3236,14 @@ selector: "dayOfMonth:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setDate(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "dayOfMonth: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4053,20 +3254,14 @@ selector: "dayOfWeek", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getDay() + 1; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "dayOfWeek\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4077,20 +3272,14 @@ selector: "dayOfWeek:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.setDay(aNumber - 1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "dayOfWeek: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4101,20 +3290,14 @@ selector: "hours", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getHours(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "hours\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4125,20 +3308,14 @@ selector: "hours:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setHours(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "hours: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4149,20 +3326,14 @@ selector: "milliseconds", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getMilliseconds(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "milliseconds\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4173,20 +3344,14 @@ selector: "milliseconds:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setMilliseconds(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "milliseconds: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4197,20 +3362,14 @@ selector: "minutes", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getMinutes(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "minutes\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4221,20 +3380,14 @@ selector: "minutes:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setMinutes(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "minutes: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4245,20 +3398,14 @@ selector: "month", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getMonth() + 1; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "month\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4269,20 +3416,14 @@ selector: "month:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setMonth(aNumber - 1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "month: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4293,20 +3434,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._asString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "asString"] }), $globals.Date); @@ -4317,20 +3452,14 @@ selector: "seconds", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getSeconds(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "seconds\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4341,20 +3470,14 @@ selector: "seconds:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setSeconds(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "seconds: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4365,20 +3488,14 @@ selector: "time", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getTime(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "time\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4389,20 +3506,14 @@ selector: "time:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setTime(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "time: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4413,20 +3524,14 @@ selector: "year", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.getFullYear(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "year\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4437,20 +3542,14 @@ selector: "year:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.setFullYear(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "year: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date); @@ -4465,11 +3564,9 @@ var self=this; return "magnitude"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date.klass); @@ -4480,21 +3577,15 @@ selector: "fromMilliseconds:", protocol: 'instance creation', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._new_(aNumber); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new:"] }), $globals.Date.klass); @@ -4505,21 +3596,15 @@ selector: "fromSeconds:", protocol: 'instance creation', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._fromMilliseconds_($recv(aNumber).__star((1000))); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fromMilliseconds:", "*"] }), $globals.Date.klass); @@ -4530,21 +3615,15 @@ selector: "fromString:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._new_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new:"] }), $globals.Date.klass); @@ -4557,26 +3636,18 @@ fn: function (aBlock){ var self=this; var t; function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; t=$recv($Date())._now(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["now"]=1; -//>>excludeEnd("ctx"); $recv(aBlock)._value(); $1=$recv($recv($Date())._now()).__minus(t); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t", referencedClasses: ["Date"], -//>>excludeEnd("ide"); messageSends: ["now", "value", "-"] }), $globals.Date.klass); @@ -4587,20 +3658,14 @@ selector: "new:", protocol: 'instance creation', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new Date(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "new: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Date.klass); @@ -4611,21 +3676,15 @@ selector: "now", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._today(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "now\x0a\x09^ self today", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["today"] }), $globals.Date.klass); @@ -4636,50 +3695,36 @@ selector: "today", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "today\x0a\x09^ self new", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new"] }), $globals.Date.klass); $core.addClass('Number', $globals.Object, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ]."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "&", protocol: 'converting', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self & aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "& aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4690,20 +3735,14 @@ selector: "*", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self * aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4714,21 +3753,15 @@ selector: "**", protocol: 'mathematical functions', fn: function (exponent){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._raisedTo_(exponent); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["exponent"], source: "** exponent\x0a\x09^ self raisedTo: exponent", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["raisedTo:"] }), $globals.Number); @@ -4739,20 +3772,14 @@ selector: "+", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self + aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4763,20 +3790,14 @@ selector: "-", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self - aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4787,20 +3808,14 @@ selector: "/", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self / aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4811,21 +3826,15 @@ selector: "//", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self.__slash(aNumber))._floor(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "// aNumber\x0a\x09^ (self / aNumber) floor", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["floor", "/"] }), $globals.Number); @@ -4836,20 +3845,14 @@ selector: "<", protocol: 'comparing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self < aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4860,49 +3863,32 @@ selector: "<=", protocol: 'comparing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self <= aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); $core.addMethod( $core.method({ -selector: "=", +selector: "==", protocol: 'comparing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); - - return aNumber != null && - typeof aNumber._isNumber === "function" && - aNumber._isNumber() && - Number(self) == aNumber - ; +return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], -source: "= aNumber\x0a\x09<\x0a\x09\x09return aNumber != null &&\x0a\x09\x09\x09typeof aNumber._isNumber === \x22function\x22 &&\x0a\x09\x09\x09aNumber._isNumber() &&\x0a\x09\x09\x09Number(self) == aNumber\x0a\x09>", +source: "== aNumber\x0a", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4913,20 +3899,14 @@ selector: ">", protocol: 'comparing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self > aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09> aNumber>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4937,20 +3917,14 @@ selector: ">=", protocol: 'comparing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self >= aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09>= aNumber>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -4962,21 +3936,15 @@ protocol: 'converting', fn: function (aNumber){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Point())._x_y_(self,aNumber); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "@ aNumber\x0a\x09^ Point x: self y: aNumber", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:"] }), $globals.Number); @@ -4987,20 +3955,14 @@ selector: "\x5c\x5c", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self % aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "\x5c\x5c aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5011,20 +3973,14 @@ selector: "abs", protocol: 'arithmetic', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.abs(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "abs\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5035,20 +3991,14 @@ selector: "arcCos", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.acos(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arcCos\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5059,20 +4009,14 @@ selector: "arcSin", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.asin(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arcSin\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5083,20 +4027,14 @@ selector: "arcTan", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.atan(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arcTan\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5110,11 +4048,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5125,24 +4061,16 @@ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv("(".__comma(self._printString())).__comma(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09^ '(', self printString, ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "printString"] }), $globals.Number); @@ -5156,11 +4084,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asNumber\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5172,21 +4098,15 @@ protocol: 'converting', fn: function (){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Point())._x_y_(self,self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asPoint\x0a\x09^ Point x: self y: self", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:"] }), $globals.Number); @@ -5197,20 +4117,14 @@ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09< return String(self) >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5222,21 +4136,15 @@ protocol: 'converting', fn: function (){ var self=this; function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1", referencedClasses: ["Random"], -//>>excludeEnd("ide"); messageSends: ["+", "truncated", "*", "next", "new"] }), $globals.Number); @@ -5247,20 +4155,14 @@ selector: "ceiling", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.ceil(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "ceiling\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5274,11 +4176,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "copy\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5289,20 +4189,14 @@ selector: "cos", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.cos(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "cos\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5313,21 +4207,15 @@ selector: "deepCopy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._copy(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09^ self copy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copy"] }), $globals.Number); @@ -5338,21 +4226,15 @@ selector: "even", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=(0).__eq(self.__backslash_backslash((2))); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=", "\x5c\x5c"] }), $globals.Number); @@ -5363,49 +4245,18 @@ selector: "floor", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.floor(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "floor\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); -$core.addMethod( -$core.method({ -selector: "identityHash", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._asString()).__comma("n"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.Number)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "identityHash\x0a\x09^ self asString, 'n'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "asString"] -}), -$globals.Number); - $core.addMethod( $core.method({ selector: "isImmutable", @@ -5415,11 +4266,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5433,11 +4282,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isNumber\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5448,21 +4295,15 @@ selector: "isZero", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__eq((0)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isZero\x0a\x09^ self = 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["="] }), $globals.Number); @@ -5473,20 +4314,14 @@ selector: "ln", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.log(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "ln\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5497,20 +4332,14 @@ selector: "log", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.log(self) / Math.LN10;; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "log\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5521,20 +4350,14 @@ selector: "log:", protocol: 'mathematical functions', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.log(self) / Math.log(aNumber);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "log: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5545,20 +4368,14 @@ selector: "max:", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.max(self, aNumber);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "max: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5569,20 +4386,14 @@ selector: "min:", protocol: 'arithmetic', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.min(self, aNumber);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "min: aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5593,21 +4404,15 @@ selector: "negated", protocol: 'arithmetic', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=(0).__minus(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "negated\x0a\x09^ 0 - self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["-"] }), $globals.Number); @@ -5618,21 +4423,15 @@ selector: "negative", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__lt((0)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["<"] }), $globals.Number); @@ -5643,21 +4442,15 @@ selector: "odd", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._even())._not(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "odd\x0a\x09^ self even not", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["not", "even"] }), $globals.Number); @@ -5668,21 +4461,15 @@ selector: "positive", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__gt_eq((0)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [">="] }), $globals.Number); @@ -5693,20 +4480,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._asString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "asString"] }), $globals.Number); @@ -5717,20 +4498,14 @@ selector: "printShowingDecimalPlaces:", protocol: 'printing', fn: function (placesDesired){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toFixed(placesDesired); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["placesDesired"], source: "printShowingDecimalPlaces: placesDesired\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5741,20 +4516,14 @@ selector: "raisedTo:", protocol: 'mathematical functions', fn: function (exponent){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.pow(self, exponent);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["exponent"], source: "raisedTo: exponent\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5765,20 +4534,14 @@ selector: "rounded", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.round(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "rounded\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5789,9 +4552,7 @@ selector: "sign", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=self._isZero(); if($core.assert($1)){ @@ -5804,15 +4565,11 @@ return (1); return (-1); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"] }), $globals.Number); @@ -5823,20 +4580,14 @@ selector: "sin", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.sin(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sin\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5847,20 +4598,14 @@ selector: "sqrt", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.sqrt(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sqrt\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5871,21 +4616,15 @@ selector: "squared", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self.__star(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "squared\x0a\x09^ self * self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["*"] }), $globals.Number); @@ -5896,20 +4635,14 @@ selector: "tan", protocol: 'mathematical functions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.tan(self);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "tan\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -5921,39 +4654,25 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var count; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); count=(1); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(count).__gt(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(aBlock)._value(); count=$recv(count).__plus((1)); return count; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileFalse:", ">", "value", "+"] }), $globals.Number); @@ -5966,47 +4685,31 @@ fn: function (aNumber){ var self=this; var array,first,last,count; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; first=self._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["truncated"]=1; -//>>excludeEnd("ctx"); last=$recv($recv(aNumber)._truncated()).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["+"]=1; -//>>excludeEnd("ctx"); count=(1); array=$recv($Array())._new(); $recv($recv(last).__minus(first))._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(array)._at_put_(count,first); count=$recv(count).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=2; -//>>excludeEnd("ctx"); count; first=$recv(first).__plus((1)); return first; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=array; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"] }), $globals.Number); @@ -6019,9 +4722,7 @@ fn: function (stop,step){ var self=this; var array,value,pos; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; value=self; array=$recv($Array())._new(); @@ -6033,75 +4734,45 @@ self._error_("step must be non-zero"); $2=$recv(step).__lt((0)); if($core.assert($2)){ $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(value).__gt_eq(stop); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(array)._at_put_(pos,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); pos=$recv(pos).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); pos; value=$recv(value).__plus(step); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=2; -//>>excludeEnd("ctx"); return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["whileTrue:"]=1; -//>>excludeEnd("ctx"); } else { $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(value).__lt_eq(stop); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(array)._at_put_(pos,value); pos=$recv(pos).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=3; -//>>excludeEnd("ctx"); pos; value=$recv(value).__plus(step); return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); -//>>excludeEnd("ctx"); })); }; $3=array; return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["stop", "step"], source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="] }), $globals.Number); @@ -6113,9 +4784,7 @@ protocol: 'enumerating', fn: function (stop,step,aBlock){ var self=this; var value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; value=self; $1=$recv(step).__eq((0)); @@ -6125,64 +4794,38 @@ self._error_("step must be non-zero"); $2=$recv(step).__lt((0)); if($core.assert($2)){ $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(value).__gt_eq(stop); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(aBlock)._value_(value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); value=$recv(value).__plus(step); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["whileTrue:"]=1; -//>>excludeEnd("ctx"); } else { $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(value).__lt_eq(stop); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(aBlock)._value_(value); value=$recv(value).__plus(step); return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); -//>>excludeEnd("ctx"); })); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["stop", "step", "aBlock"], source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="] }), $globals.Number); @@ -6194,39 +4837,25 @@ protocol: 'enumerating', fn: function (stop,aBlock){ var self=this; var nextValue; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); nextValue=self; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(nextValue).__lt_eq(stop); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(aBlock)._value_(nextValue); nextValue=$recv(nextValue).__plus((1)); return nextValue; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["stop", "aBlock"], source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileTrue:", "<=", "value:", "+"] }), $globals.Number); @@ -6237,9 +4866,7 @@ selector: "truncated", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self >= 0) { return Math.floor(self); @@ -6248,15 +4875,11 @@ return $core.withContext(function($ctx1) { }; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -6267,20 +4890,14 @@ selector: "|", protocol: 'converting', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self | aNumber; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "| aNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number); @@ -6295,11 +4912,9 @@ var self=this; return "magnitude"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number.klass); @@ -6310,20 +4925,14 @@ selector: "e", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.E;; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "e\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number.klass); @@ -6334,29 +4943,21 @@ selector: "pi", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.PI; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "pi\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Number.klass); $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "*", @@ -6364,39 +4965,25 @@ protocol: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$5,$4,$2,$7,$6,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $5=$recv(aPoint)._asPoint(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asPoint"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._x(); $2=$recv($3).__star($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["*"]=1; -//>>excludeEnd("ctx"); $7=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y()); $1=$recv($Point())._x_y_($2,$6); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:", "*", "x", "asPoint", "y"] }), $globals.Point); @@ -6408,39 +4995,25 @@ protocol: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$5,$4,$2,$7,$6,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $5=$recv(aPoint)._asPoint(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asPoint"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._x(); $2=$recv($3).__plus($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["+"]=1; -//>>excludeEnd("ctx"); $7=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y()); $1=$recv($Point())._x_y_($2,$6); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:", "+", "x", "asPoint", "y"] }), $globals.Point); @@ -6452,39 +5025,25 @@ protocol: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$5,$4,$2,$7,$6,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $5=$recv(aPoint)._asPoint(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asPoint"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._x(); $2=$recv($3).__minus($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["-"]=1; -//>>excludeEnd("ctx"); $7=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y()); $1=$recv($Point())._x_y_($2,$6); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:", "-", "x", "asPoint", "y"] }), $globals.Point); @@ -6496,39 +5055,25 @@ protocol: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$5,$4,$2,$7,$6,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $5=$recv(aPoint)._asPoint(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asPoint"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._x(); $2=$recv($3).__slash($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["/"]=1; -//>>excludeEnd("ctx"); $7=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y()); $1=$recv($Point())._x_y_($2,$6); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y", referencedClasses: ["Point"], -//>>excludeEnd("ide"); messageSends: ["x:y:", "/", "x", "asPoint", "y"] }), $globals.Point); @@ -6539,41 +5084,25 @@ selector: "<", protocol: 'comparing', fn: function (aPoint){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$4,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__lt($recv(aPoint)._x()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["<"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["y"]=1; -//>>excludeEnd("ctx"); return $recv($4).__lt($recv(aPoint)._y()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", "<", "x", "y"] }), $globals.Point); @@ -6584,41 +5113,25 @@ selector: "<=", protocol: 'comparing', fn: function (aPoint){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$4,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__lt_eq($recv(aPoint)._x()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["<="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["y"]=1; -//>>excludeEnd("ctx"); return $recv($4).__lt_eq($recv(aPoint)._y()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", "<=", "x", "y"] }), $globals.Point); @@ -6629,50 +5142,30 @@ selector: "=", protocol: 'comparing', fn: function (aPoint){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$5,$4,$7,$6,$1; $3=$recv(aPoint)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__eq(self._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $5=$recv(aPoint)._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $4=$recv($5).__eq(self._x()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["="]=2; -//>>excludeEnd("ctx"); $7=$recv(aPoint)._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["y"]=1; -//>>excludeEnd("ctx"); $6=$recv($7).__eq(self._y()); return $recv($4).__and($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", "=", "class", "&", "x", "y"] }), $globals.Point); @@ -6683,41 +5176,25 @@ selector: ">", protocol: 'comparing', fn: function (aPoint){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$4,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__gt($recv(aPoint)._x()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[">"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["y"]=1; -//>>excludeEnd("ctx"); return $recv($4).__gt($recv(aPoint)._y()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", ">", "x", "y"] }), $globals.Point); @@ -6728,41 +5205,25 @@ selector: ">=", protocol: 'comparing', fn: function (aPoint){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$4,$1; $3=self._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__gt_eq($recv(aPoint)._x()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[">="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=self._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["y"]=1; -//>>excludeEnd("ctx"); return $recv($4).__gt_eq($recv(aPoint)._y()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", ">=", "x", "y"] }), $globals.Point); @@ -6776,11 +5237,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asPoint\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point); @@ -6792,31 +5251,21 @@ protocol: 'transforming', fn: function (aPoint){ var self=this; var dx,dy; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; dx=$recv($recv(aPoint)._x()).__minus(self["@x"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["-"]=1; -//>>excludeEnd("ctx"); dy=$recv($recv(aPoint)._y()).__minus(self["@y"]); $3=$recv(dx).__star(dx); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["*"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__plus($recv(dy).__star(dy)); $1=$recv($2)._sqrt(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPoint"], source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["-", "x", "y", "sqrt", "+", "*"] }), $globals.Point); @@ -6827,38 +5276,26 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(self["@x"])._printOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["printOn:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_("@"); $1=$recv($recv(self["@y"])._notNil())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@y"])._negative(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); if($core.assert($1)){ $recv(aStream)._space(); }; $recv(self["@y"])._printOn_(aStream); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"] }), $globals.Point); @@ -6869,25 +5306,17 @@ selector: "translateBy:", protocol: 'transforming', fn: function (delta){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=$recv($recv(delta)._x()).__plus(self["@x"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["+"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"])); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["delta"], source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["@", "+", "x", "y"] }), $globals.Point); @@ -6903,11 +5332,9 @@ $1=self["@x"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "x\x0a\x09^ x", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point); @@ -6922,11 +5349,9 @@ self["@x"]=aNumber; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "x: aNumber\x0a\x09x := aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point); @@ -6942,11 +5367,9 @@ $1=self["@y"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "y\x0a\x09^ y", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point); @@ -6961,11 +5384,9 @@ self["@y"]=aNumber; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "y: aNumber\x0a\x09y := aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point); @@ -6980,11 +5401,9 @@ var self=this; return "magnitude"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Point.klass); @@ -6995,9 +5414,7 @@ selector: "x:y:", protocol: 'instance creation', fn: function (aNumber,anotherNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._x_(aNumber); @@ -7005,44 +5422,32 @@ $recv($2)._y_(anotherNumber); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber", "anotherNumber"], source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["x:", "new", "y:", "yourself"] }), $globals.Point.klass); $core.addClass('Random', $globals.Object, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "next", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Math.random(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "next\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Random); @@ -7053,29 +5458,19 @@ selector: "next:", protocol: 'accessing', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv((1)._to_(anInteger))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "to:", "next"] }), $globals.Random); @@ -7083,9 +5478,7 @@ $globals.Random); $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "asJSON", @@ -7097,11 +5490,9 @@ $1=null; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09^ null", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7115,11 +5506,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7130,23 +5519,17 @@ selector: "ifNil:", protocol: 'testing', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._ifNil_ifNotNil_(aBlock,(function(){ })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:"] }), $globals.UndefinedObject); @@ -7157,21 +5540,15 @@ selector: "ifNil:ifNotNil:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(aBlock)._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value"] }), $globals.UndefinedObject); @@ -7185,11 +5562,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7200,21 +5575,15 @@ selector: "ifNotNil:ifNil:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(anotherBlock)._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value"] }), $globals.UndefinedObject); @@ -7228,11 +5597,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7246,11 +5613,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isNil\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7264,11 +5629,9 @@ var self=this; return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "notNil\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7279,20 +5642,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_("nil"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:"] }), $globals.UndefinedObject); @@ -7306,11 +5663,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.UndefinedObject); @@ -7321,21 +5676,15 @@ selector: "subclass:instanceVariableNames:", protocol: 'class creation', fn: function (aString,anotherString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString"], source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.UndefinedObject); @@ -7346,21 +5695,15 @@ selector: "subclass:instanceVariableNames:category:", protocol: 'class creation', fn: function (aString,aString2,aString3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.UndefinedObject); @@ -7371,21 +5714,15 @@ selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:ca protocol: 'class creation', fn: function (aString,aString2,classVars,pools,aString3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "classVars", "pools", "aString3"], source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.UndefinedObject); @@ -7397,21 +5734,15 @@ protocol: 'class creation', fn: function (aString,aString2,aString3){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"] }), $globals.UndefinedObject); @@ -7423,20 +5754,14 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("You cannot create new instances of UndefinedObject. Use nil"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:"] }), $globals.UndefinedObject.klass); @@ -7450,30 +5775,22 @@ $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr) $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: ">>", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._methodAt_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: ">> aString\x0a\x09^ self methodAt: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["methodAt:"] }), $globals.Behavior); @@ -7488,9 +5805,7 @@ var oldMethod,announcement; function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)} function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)} function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver; oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){ return nil; @@ -7498,16 +5813,12 @@ return nil; })); $2=self._protocols(); $3=$recv(aMethod)._protocol(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["protocol"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._includes_($3); if(!$core.assert($1)){ $4=self._organization(); $5=$recv(aMethod)._protocol(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["protocol"]=2; -//>>excludeEnd("ctx"); $recv($4)._addElement_($5); }; self._basicAddCompiledMethod_(aMethod); @@ -7520,17 +5831,11 @@ self._removeProtocolIfEmpty_($recv(oldMethod)._protocol()); $7=oldMethod; if(($receiver = $7) == null || $receiver.isNil){ $8=$recv($MethodAdded())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); $recv($8)._method_(aMethod); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["method:"]=1; -//>>excludeEnd("ctx"); $9=$recv($8)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); announcement=$9; } else { $10=$recv($MethodModified())._new(); @@ -7541,15 +5846,11 @@ announcement=$11; }; $recv($recv($SystemAnnouncer())._current())._announce_(announcement); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement", referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"] }), $globals.Behavior); @@ -7561,15 +5862,11 @@ protocol: 'accessing', fn: function (){ var self=this; var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; result=$recv(self._instanceVariableNames())._copy(); $1=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { @@ -7577,15 +5874,11 @@ $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames()); }; $2=result; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"] }), $globals.Behavior); @@ -7596,36 +5889,24 @@ selector: "allSelectors", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$4,$1; $2=self._allSuperclasses(); $3=self._selectors(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["selectors"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._inject_into_($3,(function(acc,each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(acc)._addAll_($recv(each)._selectors()); $4=$recv(acc)._yourself(); return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"] }), $globals.Behavior); @@ -7637,45 +5918,29 @@ protocol: 'accessing', fn: function (){ var self=this; var subclasses,index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; subclasses=self._subclasses(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["subclasses"]=1; -//>>excludeEnd("ctx"); index=(1); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(index).__gt($recv(subclasses)._size()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses()); index=$recv(index).__plus((1)); return index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $1=subclasses; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"] }), $globals.Behavior); @@ -7686,28 +5951,18 @@ selector: "allSubclassesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._allSubclasses())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "allSubclasses", "value:"] }), $globals.Behavior); @@ -7719,14 +5974,10 @@ protocol: 'accessing', fn: function (){ var self=this; function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$5,$4,$6,$3,$receiver; $1=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $2=[]; return $2; @@ -7734,23 +5985,17 @@ return $2; $1; }; $5=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=2; -//>>excludeEnd("ctx"); $4=$recv($OrderedCollection())._with_($5); $recv($4)._addAll_($recv(self._superclass())._allSuperclasses()); $6=$recv($4)._yourself(); $3=$6; return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself", referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"] }), $globals.Behavior); @@ -7761,20 +6006,14 @@ selector: "basicAddCompiledMethod:", protocol: 'private', fn: function (aMethod){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.addMethod(aMethod, self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -7785,20 +6024,14 @@ selector: "basicNew", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new self.fn(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basicNew\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -7809,20 +6042,14 @@ selector: "basicRemoveCompiledMethod:", protocol: 'private', fn: function (aMethod){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.removeMethod(aMethod,self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -7833,42 +6060,26 @@ selector: "canUnderstand:", protocol: 'testing', fn: function (aSelector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._notNil(); return $recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(self._superclass())._canUnderstand_(aSelector); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aSelector"], source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"] }), $globals.Behavior); @@ -7879,9 +6090,7 @@ selector: "comment", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._basicAt_("comment"); if(($receiver = $2) == null || $receiver.isNil){ @@ -7890,15 +6099,11 @@ $1=""; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "basicAt:"] }), $globals.Behavior); @@ -7911,9 +6116,7 @@ fn: function (aString){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self._basicAt_put_("comment",aString); $1=$recv($ClassCommentChanged())._new(); @@ -7921,73 +6124,15 @@ $recv($1)._theClass_(self); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"], -//>>excludeEnd("ide"); messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.Behavior); -$core.addMethod( -$core.method({ -selector: "commentStamp", -protocol: 'accessing', -fn: function (){ -var self=this; -function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($ClassCommentReader())._new(); -$recv($2)._class_(self); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself", -referencedClasses: ["ClassCommentReader"], -//>>excludeEnd("ide"); -messageSends: ["class:", "new", "yourself"] -}), -$globals.Behavior); - -$core.addMethod( -$core.method({ -selector: "commentStamp:prior:", -protocol: 'accessing', -fn: function (aStamp,prior){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._commentStamp(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStamp", "prior"], -source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["commentStamp"] -}), -$globals.Behavior); - $core.addMethod( $core.method({ selector: "compile:protocol:", @@ -7995,21 +6140,15 @@ protocol: 'compiling', fn: function (aString,anotherString){ var self=this; function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString"], source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString", referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); messageSends: ["install:forClass:protocol:", "new"] }), $globals.Behavior); @@ -8023,11 +6162,9 @@ var self=this; return ""; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "definition\x0a\x09^ ''", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8038,29 +6175,19 @@ selector: "includesBehavior:", protocol: 'testing', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self.__eq_eq(aClass))._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._inheritsFrom_(aClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["or:", "==", "inheritsFrom:"] }), $globals.Behavior); @@ -8071,21 +6198,15 @@ selector: "includesSelector:", protocol: 'testing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._methodDictionary())._includesKey_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["includesKey:", "methodDictionary"] }), $globals.Behavior); @@ -8096,43 +6217,29 @@ selector: "inheritsFrom:", protocol: 'testing', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$4,$3,$2,$receiver; $1=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ return false; } else { $1; }; $4=self._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=2; -//>>excludeEnd("ctx"); $3=$recv(aClass).__eq_eq($4); $2=$recv($3)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._superclass())._inheritsFrom_(aClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"] }), $globals.Behavior); @@ -8143,20 +6250,14 @@ selector: "instanceVariableNames", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.iVarNames; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "instanceVariableNames\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8170,11 +6271,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBehavior\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8185,20 +6284,14 @@ selector: "javascriptConstructor", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.fn; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8209,20 +6302,14 @@ selector: "javascriptConstructor:", protocol: 'accessing', fn: function (aJavaScriptFunction){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.setClassConstructor(self, aJavaScriptFunction);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aJavaScriptFunction"], source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<$core.setClassConstructor(self, aJavaScriptFunction);>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8234,25 +6321,17 @@ protocol: 'accessing', fn: function (selector){ var self=this; var lookupClass; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; var $early={}; try { lookupClass=self; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(lookupClass).__eq(nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(lookupClass)._includesSelector_(selector); if($core.assert($1)){ $2=$recv(lookupClass)._methodAt_(selector); @@ -8260,22 +6339,16 @@ throw $early=[$2]; }; lookupClass=$recv(lookupClass)._superclass(); return lookupClass; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return nil; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["selector"], source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"] }), $globals.Behavior); @@ -8286,21 +6359,15 @@ selector: "methodAt:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._methodDictionary())._at_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:", "methodDictionary"] }), $globals.Behavior); @@ -8311,9 +6378,7 @@ selector: "methodDictionary", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var dict = $globals.HashedCollection._new(); var methods = self.methods; Object.keys(methods).forEach(function(i) { @@ -8323,15 +6388,11 @@ var dict = $globals.HashedCollection._new(); }); return dict; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodDictionary\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8343,86 +6404,48 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $3=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); $4=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); $7=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); $8=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); $6=$recv($7).__comma($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); $9=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=2; -//>>excludeEnd("ctx"); $5=$recv($6).__comma($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("| temporary variable names |"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); $10=$recv(stream)._nextPutAll_("statements"); return $10; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"] }), $globals.Behavior); @@ -8433,108 +6456,38 @@ selector: "methods", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._methodDictionary())._values(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methods\x0a\x09^ self methodDictionary values", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["values", "methodDictionary"] }), $globals.Behavior); -$core.addMethod( -$core.method({ -selector: "methodsFor:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -function $ClassCategoryReader(){return $globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($ClassCategoryReader())._new(); -$recv($2)._class_category_(self,aString); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself", -referencedClasses: ["ClassCategoryReader"], -//>>excludeEnd("ide"); -messageSends: ["class:category:", "new", "yourself"] -}), -$globals.Behavior); - -$core.addMethod( -$core.method({ -selector: "methodsFor:stamp:", -protocol: 'accessing', -fn: function (aString,aStamp){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._methodsFor_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aStamp"], -source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["methodsFor:"] -}), -$globals.Behavior); - $core.addMethod( $core.method({ selector: "methodsInProtocol:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._methods())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._protocol()).__eq(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["select:", "methods", "=", "protocol"] }), $globals.Behavior); @@ -8545,20 +6498,14 @@ selector: "name", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.className || nil; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "name\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8569,21 +6516,15 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._basicNew())._initialize(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09^ self basicNew initialize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "basicNew"] }), $globals.Behavior); @@ -8594,21 +6535,15 @@ selector: "organization", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("organization"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "organization\x0a\x09^ self basicAt: 'organization'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.Behavior); @@ -8620,41 +6555,25 @@ protocol: 'accessing', fn: function (){ var self=this; function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(acc).__comma(self._methodsInProtocol_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(a)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); return $recv($2).__lt_eq($recv(b)._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]", referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"] }), $globals.Behavior); @@ -8665,29 +6584,19 @@ selector: "ownProtocols", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._protocols())._reject_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._match_("^\x5c*"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["reject:", "protocols", "match:"] }), $globals.Behavior); @@ -8699,9 +6608,7 @@ protocol: 'accessing', fn: function (aString){ var self=this; function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; $1=$recv(aString)._beginsWith_("*"); if(!$core.assert($1)){ @@ -8713,15 +6620,11 @@ return nil; })); return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]", referencedClasses: ["Package"], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"] }), $globals.Behavior); @@ -8732,21 +6635,15 @@ selector: "protocols", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv(self._organization())._elements())._sorted(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "protocols\x0a\x09^ self organization elements sorted", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sorted", "elements", "organization"] }), $globals.Behavior); @@ -8760,49 +6657,29 @@ var self=this; var methodsByProtocol; function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); methodsByProtocol=$recv($HashedCollection())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); $recv(self._methodDictionary())._valuesDo_((function(m){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv($Array())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })))._add_(m); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $recv(self._protocols())._do_((function(protocol){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]", referencedClasses: ["HashedCollection", "Array"], -//>>excludeEnd("ide"); messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"] }), $globals.Behavior); @@ -8813,20 +6690,14 @@ selector: "prototype", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.fn.prototype; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "prototype\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -8838,21 +6709,15 @@ protocol: 'compiling', fn: function (){ var self=this; function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Compiler())._new())._recompile_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "recompile\x0a\x09^ Compiler new recompile: self", referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); messageSends: ["recompile:", "new"] }), $globals.Behavior); @@ -8865,9 +6730,7 @@ fn: function (aMethod){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self._basicRemoveCompiledMethod_(aMethod); self._removeProtocolIfEmpty_($recv(aMethod)._protocol()); @@ -8876,15 +6739,11 @@ $recv($1)._method_(aMethod); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "MethodRemoved"], -//>>excludeEnd("ide"); messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"] }), $globals.Behavior); @@ -8895,36 +6754,22 @@ selector: "removeProtocolIfEmpty:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._methods())._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._protocol()).__eq(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._organization())._removeElement_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"] }), $globals.Behavior); @@ -8935,21 +6780,15 @@ selector: "selectors", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._methodDictionary())._keys(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "selectors\x0a\x09^ self methodDictionary keys", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["keys", "methodDictionary"] }), $globals.Behavior); @@ -8960,20 +6799,14 @@ selector: "subclasses", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "subclasses\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Behavior); @@ -8984,20 +6817,14 @@ selector: "superclass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.superclass || nil; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "superclass\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Behavior); @@ -9008,20 +6835,14 @@ selector: "theMetaClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theMetaClass\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Behavior); @@ -9032,20 +6853,14 @@ selector: "theNonMetaClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theNonMetaClass\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Behavior); @@ -9057,24 +6872,18 @@ protocol: 'accessing', fn: function (){ var self=this; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=$recv($Array())._with_(self); $recv($2)._addAll_(self._allSubclasses()); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["addAll:", "with:", "allSubclasses", "yourself"] }), $globals.Behavior); @@ -9082,30 +6891,22 @@ $globals.Behavior); $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1="$globals.".__comma(self._name()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09^ '$globals.', self name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "name"] }), $globals.Class); @@ -9117,20 +6918,14 @@ protocol: 'browsing', fn: function (){ var self=this; function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Finder())._findClass_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "browse\x0a\x09Finder findClass: self", referencedClasses: ["Finder"], -//>>excludeEnd("ide"); messageSends: ["findClass:"] }), $globals.Class); @@ -9141,29 +6936,21 @@ selector: "category", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["package"]=1; -//>>excludeEnd("ctx"); if(($receiver = $2) == null || $receiver.isNil){ $1="Unclassified"; } else { $1=$recv(self._package())._name(); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:", "package", "name"] }), $globals.Class); @@ -9177,11 +6964,9 @@ var self=this; return "class"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Class); @@ -9193,102 +6978,56 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$4,$2,$5,$6,$7,$1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($recv(self._superclass())._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(" subclass: #"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(self._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); $3=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); $4=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); $5=$recv(stream)._nextPutAll_("instanceVariableNames: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); $5; $recv(self._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); })); $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("package: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(self._category()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); $7=$recv(stream)._nextPutAll_("'"); return $7; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"] }), $globals.Class); @@ -9302,11 +7041,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isClass\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Class); @@ -9317,21 +7054,15 @@ selector: "package", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("pkg"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "package\x0a\x09^ self basicAt: 'pkg'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.Class); @@ -9345,14 +7076,10 @@ var self=this; var oldPackage; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$4,$5; $2=self._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["package"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__eq(aPackage); if($core.assert($1)){ return self; @@ -9360,9 +7087,7 @@ return self; oldPackage=self._package(); self._basicAt_put_("pkg",aPackage); $3=$recv(oldPackage)._organization(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["organization"]=1; -//>>excludeEnd("ctx"); $recv($3)._removeElement_(self); $recv($recv(aPackage)._organization())._addElement_(self); $4=$recv($ClassMoved())._new(); @@ -9371,15 +7096,11 @@ $recv($4)._oldPackage_(oldPackage); $5=$recv($4)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($5); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackage"], source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ClassMoved"], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"] }), $globals.Class); @@ -9390,20 +7111,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._name()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "name"] }), $globals.Class); @@ -9415,20 +7130,14 @@ protocol: 'accessing', fn: function (aString){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["renameClass:to:", "new"] }), $globals.Class); @@ -9439,21 +7148,15 @@ selector: "subclass:instanceVariableNames:", protocol: 'class creation', fn: function (aString,anotherString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString"], source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.Class); @@ -9464,21 +7167,15 @@ selector: "subclass:instanceVariableNames:category:", protocol: 'class creation', fn: function (aString,aString2,aString3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.Class); @@ -9489,21 +7186,15 @@ selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:ca protocol: 'class creation', fn: function (aString,aString2,classVars,pools,aString3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "classVars", "pools", "aString3"], source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:instanceVariableNames:package:"] }), $globals.Class); @@ -9515,21 +7206,15 @@ protocol: 'class creation', fn: function (aString,aString2,aString3){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"] }), $globals.Class); @@ -9540,20 +7225,14 @@ selector: "subclasses", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.subclasses._copy(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "subclasses\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Class); @@ -9564,21 +7243,15 @@ selector: "theMetaClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._class(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theMetaClass\x0a\x09^ self class", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["class"] }), $globals.Class); @@ -9592,11 +7265,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theNonMetaClass\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Class); @@ -9604,33 +7275,23 @@ $globals.Class); $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "name", "instanceClass"] }), $globals.Metaclass); @@ -9642,61 +7303,35 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(self._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $2; $recv(self._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); })); return $recv(stream)._nextPutAll_("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"] }), $globals.Metaclass); @@ -9707,20 +7342,14 @@ selector: "instanceClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.instanceClass; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "instanceClass\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Metaclass); @@ -9732,20 +7361,14 @@ protocol: 'accessing', fn: function (aCollection){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["class:instanceVariableNames:", "new"] }), $globals.Metaclass); @@ -9759,11 +7382,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isMetaclass\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Metaclass); @@ -9774,21 +7395,15 @@ selector: "package", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._instanceClass())._package(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "package\x0a\x09^ self instanceClass package", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["package", "instanceClass"] }), $globals.Metaclass); @@ -9799,25 +7414,17 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_(" class"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "name", "instanceClass"] }), $globals.Metaclass); @@ -9828,37 +7435,23 @@ selector: "subclasses", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._isMetaclass())._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._theMetaClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"] }), $globals.Metaclass); @@ -9872,11 +7465,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theMetaClass\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Metaclass); @@ -9887,21 +7478,15 @@ selector: "theNonMetaClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._instanceClass(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theNonMetaClass\x0a\x09^ self instanceClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["instanceClass"] }), $globals.Metaclass); @@ -9909,9 +7494,7 @@ $globals.Metaclass); $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addSubclassOf:named:instanceVariableNames:package:", @@ -9921,9 +7504,7 @@ var self=this; var theClass,thePackage; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$receiver; theClass=$recv($recv($Smalltalk())._globals())._at_(className); thePackage=$recv($Package())._named_(packageName); @@ -9940,15 +7521,11 @@ return $3; }; $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName); return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "className", "aCollection", "packageName"], source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName", referencedClasses: ["Smalltalk", "Package"], -//>>excludeEnd("ide"); messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"] }), $globals.ClassBuilder); @@ -9959,23 +7536,17 @@ selector: "basicAddSubclassOf:named:instanceVariableNames:package:", protocol: 'private', fn: function (aClass,aString,aCollection,packageName){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.addClass(aString, aClass, aCollection, packageName); return $globals[aString] ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aString", "aCollection", "packageName"], source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09$core.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return $globals[aString]\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -9986,20 +7557,14 @@ selector: "basicClass:instanceVariableNames:", protocol: 'private', fn: function (aClass,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aString"], source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"] }), $globals.ClassBuilder); @@ -10010,9 +7575,7 @@ selector: "basicClass:instanceVariables:", protocol: 'private', fn: function (aClass,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(aClass)._isMetaclass(); if(!$core.assert($1)){ @@ -10020,15 +7583,11 @@ self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass")); }; $recv(aClass)._basicAt_put_("iVarNames",aCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aCollection"], source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"] }), $globals.ClassBuilder); @@ -10039,20 +7598,14 @@ selector: "basicRemoveClass:", protocol: 'private', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.removeClass(aClass); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -10063,24 +7616,18 @@ selector: "basicRenameClass:to:", protocol: 'private', fn: function (aClass,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $globals[aString] = aClass; delete $globals[aClass.className]; aClass.className = aString; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aString"], source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -10091,24 +7638,18 @@ selector: "basicSwapClassNames:with:", protocol: 'private', fn: function (aClass,anotherClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var tmp = aClass.className; aClass.className = anotherClass.className; anotherClass.className = tmp; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "anotherClass"], source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -10121,9 +7662,7 @@ fn: function (aClass,ivarNames){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self._basicClass_instanceVariableNames_(aClass,ivarNames); self._setupClass_(aClass); @@ -10132,15 +7671,11 @@ $recv($1)._theClass_(aClass); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "ivarNames"], source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"], -//>>excludeEnd("ide"); messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.ClassBuilder); @@ -10154,9 +7689,7 @@ var self=this; var newClass; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name()); self._copyClass_to_(aClass,newClass); @@ -10166,15 +7699,11 @@ $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); $3=newClass; return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "className"], source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass", referencedClasses: ["SystemAnnouncer", "ClassAdded"], -//>>excludeEnd("ide"); messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.ClassBuilder); @@ -10186,77 +7715,45 @@ protocol: 'copying', fn: function (aClass,anotherClass){ var self=this; function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5,$7,$6,$9,$8; $recv(anotherClass)._comment_($recv(aClass)._comment()); $1=$recv(aClass)._methodDictionary(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodDictionary"]=1; -//>>excludeEnd("ctx"); $recv($1)._valuesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv($Compiler())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["new"]=1; -//>>excludeEnd("ctx"); $3=$recv(each)._source(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["source"]=1; -//>>excludeEnd("ctx"); $4=$recv(each)._protocol(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["protocol"]=1; -//>>excludeEnd("ctx"); return $recv($2)._install_forClass_protocol_($3,anotherClass,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["install:forClass:protocol:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["valuesDo:"]=1; -//>>excludeEnd("ctx"); $5=$recv(anotherClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $7=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=2; -//>>excludeEnd("ctx"); $6=$recv($7)._instanceVariableNames(); self._basicClass_instanceVariables_($5,$6); $9=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=3; -//>>excludeEnd("ctx"); $8=$recv($9)._methodDictionary(); $recv($8)._valuesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); self._setupClass_(anotherClass); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "anotherClass"], source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass", referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"] }), $globals.ClassBuilder); @@ -10267,21 +7764,15 @@ selector: "installMethod:forClass:protocol:", protocol: 'method definition', fn: function (aCompiledMethod,aBehavior,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aCompiledMethod)._protocol_(aString); $recv(aBehavior)._addCompiledMethod_(aCompiledMethod); return aCompiledMethod; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCompiledMethod", "aBehavior", "aString"], source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["protocol:", "addCompiledMethod:"] }), $globals.ClassBuilder); @@ -10292,29 +7783,19 @@ selector: "instanceVariableNamesFor:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._isEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["reject:", "tokenize:", "isEmpty"] }), $globals.ClassBuilder); @@ -10325,25 +7806,17 @@ selector: "migrateClass:superclass:", protocol: 'class migration', fn: function (aClass,anotherClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=$recv(aClass)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "anotherClass"], source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"] }), $globals.ClassBuilder); @@ -10359,53 +7832,33 @@ function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"? function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5; tmp="new*".__comma(className); oldClass=$recv($recv($Smalltalk())._globals())._at_(className); newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName); self._basicSwapClassNames_with_(oldClass,newClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["basicSwapClassNames:with:"]=1; -//>>excludeEnd("ctx"); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._copyClass_to_(oldClass,newClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._on_do_($Error(),(function(exception){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._basicSwapClassNames_with_(oldClass,newClass); $1=self._basicRemoveClass_(newClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["basicRemoveClass:"]=1; -//>>excludeEnd("ctx"); $1; return $recv(exception)._resignal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)}); -//>>excludeEnd("ctx"); })); self._rawRenameClass_to_(oldClass,tmp); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["rawRenameClass:to:"]=1; -//>>excludeEnd("ctx"); $2=self._rawRenameClass_to_(newClass,className); $recv($recv(oldClass)._subclasses())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._migrateClass_superclass_(each,newClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); })); self._basicRemoveClass_(oldClass); $3=$recv($ClassMigrated())._new(); @@ -10415,15 +7868,11 @@ $4=$recv($3)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($4); $5=newClass; return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["className", "aClass", "aCollection", "packageName"], source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass", referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"], -//>>excludeEnd("ide"); messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"] }), $globals.ClassBuilder); @@ -10434,22 +7883,16 @@ selector: "rawRenameClass:to:", protocol: 'private', fn: function (aClass,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $globals[aString] = aClass; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aString"], source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -10462,9 +7905,7 @@ fn: function (aClass,className){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self._basicRenameClass_to_(aClass,className); $recv(aClass)._recompile(); @@ -10473,15 +7914,11 @@ $recv($1)._theClass_(aClass); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "className"], source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ClassRenamed"], -//>>excludeEnd("ide"); messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.ClassBuilder); @@ -10492,20 +7929,14 @@ selector: "setupClass:", protocol: 'public', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.init(aClass);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "setupClass: aClass\x0a\x09<$core.init(aClass);>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassBuilder); @@ -10516,21 +7947,15 @@ selector: "superclass:subclass:", protocol: 'class definition', fn: function (aClass,className){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "className"], source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["superclass:subclass:instanceVariableNames:package:"] }), $globals.ClassBuilder); @@ -10544,9 +7969,7 @@ var self=this; var newClass; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5,$receiver; $1=self._instanceVariableNamesFor_(ivarNames); if(($receiver = packageName) == null || $receiver.isNil){ @@ -10562,262 +7985,19 @@ $4=$recv($3)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($4); $5=newClass; return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "className", "ivarNames", "packageName"], source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass", referencedClasses: ["SystemAnnouncer", "ClassAdded"], -//>>excludeEnd("ide"); messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.ClassBuilder); -$core.addClass('ClassCategoryReader', $globals.Object, ['class', 'category'], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "class:category:", -protocol: 'accessing', -fn: function (aClass,aString){ -var self=this; -self["@class"]=aClass; -self["@category"]=aString; -return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass", "aString"], -source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ClassCategoryReader); - -$core.addMethod( -$core.method({ -selector: "compileMethod:", -protocol: 'private', -fn: function (aString){ -var self=this; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassCategoryReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category", -referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); -messageSends: ["install:forClass:protocol:", "new"] -}), -$globals.ClassCategoryReader); - -$core.addMethod( -$core.method({ -selector: "initialize", -protocol: 'initialization', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCategoryReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "initialize\x0a\x09super initialize.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initialize"] -}), -$globals.ClassCategoryReader); - -$core.addMethod( -$core.method({ -selector: "scanFrom:", -protocol: 'fileIn', -fn: function (aChunkParser){ -var self=this; -var chunk; -function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -chunk=$recv(aChunkParser)._nextChunk(); -chunk; -return $recv(chunk)._isEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._compileMethod_(chunk); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCategoryReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aChunkParser"], -source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class", -referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); -messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"] -}), -$globals.ClassCategoryReader); - - - -$core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "class:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -self["@class"]=aClass; -return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "class: aClass\x0a\x09class := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ClassCommentReader); - -$core.addMethod( -$core.method({ -selector: "initialize", -protocol: 'initialization', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "initialize\x0a\x09super initialize.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initialize"] -}), -$globals.ClassCommentReader); - -$core.addMethod( -$core.method({ -selector: "scanFrom:", -protocol: 'fileIn', -fn: function (aChunkParser){ -var self=this; -var chunk; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -chunk=$recv(aChunkParser)._nextChunk(); -$1=$recv(chunk)._isEmpty(); -if(!$core.assert($1)){ -self._setComment_(chunk); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aChunkParser"], -source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"] -}), -$globals.ClassCommentReader); - -$core.addMethod( -$core.method({ -selector: "setComment:", -protocol: 'private', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@class"])._comment_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "setComment: aString\x0a\x09class comment: aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["comment:"] -}), -$globals.ClassCommentReader); - - - $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "getNodesFrom:", @@ -10826,48 +8006,32 @@ fn: function (aCollection){ var self=this; var children,others; function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; children=[]; others=[]; $recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv($recv(each)._superclass()).__eq(self._theClass()); if($core.assert($1)){ return $recv(children)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); } else { return $recv(others)._add_(each); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); self["@nodes"]=$recv(children)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]", referencedClasses: ["ClassSorterNode"], -//>>excludeEnd("ide"); messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"] }), $globals.ClassSorterNode); @@ -10883,11 +8047,9 @@ $1=self["@level"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "level\x0a\x09^ level", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassSorterNode); @@ -10902,11 +8064,9 @@ self["@level"]=anInteger; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "level: anInteger\x0a\x09level := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassSorterNode); @@ -10922,11 +8082,9 @@ $1=self["@nodes"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "nodes\x0a\x09^ nodes", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassSorterNode); @@ -10942,11 +8100,9 @@ $1=self["@theClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theClass\x0a\x09^ theClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassSorterNode); @@ -10961,11 +8117,9 @@ self["@theClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassSorterNode); @@ -10976,50 +8130,30 @@ selector: "traverseClassesWith:", protocol: 'visiting', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$2; $1=self._theClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["theClass"]=1; -//>>excludeEnd("ctx"); $recv(aCollection)._add_($1); $recv($recv(self._nodes())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=$recv(a)._theClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["theClass"]=2; -//>>excludeEnd("ctx"); $2=$recv($3)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["name"]=1; -//>>excludeEnd("ctx"); return $recv($2).__lt_eq($recv($recv(b)._theClass())._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._do_((function(aNode){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aNode)._traverseClassesWith_(aCollection); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"] }), $globals.ClassSorterNode); @@ -11031,9 +8165,7 @@ selector: "on:classes:level:", protocol: 'instance creation', fn: function (aClass,aCollection,anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._theClass_(aClass); @@ -11042,15 +8174,11 @@ $recv($2)._getNodesFrom_(aCollection); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aCollection", "anInteger"], source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"] }), $globals.ClassSorterNode.klass); @@ -11064,29 +8192,21 @@ $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr) $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "applyTo:arguments:", protocol: 'evaluating', fn: function (anObject,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.apply(anObject, aCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aCollection"], source: "applyTo: anObject arguments: aCollection\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11097,20 +8217,14 @@ selector: "asCompiledMethod:", protocol: 'converting', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.method({selector:aString, fn:self});; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "asCompiledMethod: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11121,20 +8235,14 @@ selector: "compiledSource", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "compiledSource\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11145,9 +8253,7 @@ selector: "currySelf", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return function () { var args = [ this ]; @@ -11156,15 +8262,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11175,20 +8277,14 @@ selector: "ensure:", protocol: 'evaluating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); try{return self._value()}finally{aBlock._value()}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ensure: aBlock\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11200,20 +8296,14 @@ protocol: 'timeout/interval', fn: function (){ var self=this; function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv($ForkPool())._default())._fork_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fork\x0a\x09ForkPool default fork: self", referencedClasses: ["ForkPool"], -//>>excludeEnd("ide"); messageSends: ["fork:", "default"] }), $globals.BlockClosure); @@ -11224,20 +8314,14 @@ selector: "new", protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new self(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11248,21 +8332,15 @@ selector: "newValue:", protocol: 'evaluating', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._newWithValues_([anObject]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["newWithValues:"] }), $globals.BlockClosure); @@ -11273,21 +8351,15 @@ selector: "newValue:value:", protocol: 'evaluating', fn: function (anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._newWithValues_([anObject,anObject2]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anObject2"], source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["newWithValues:"] }), $globals.BlockClosure); @@ -11298,21 +8370,15 @@ selector: "newValue:value:value:", protocol: 'evaluating', fn: function (anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._newWithValues_([anObject,anObject2,anObject3]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anObject2", "anObject3"], source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["newWithValues:"] }), $globals.BlockClosure); @@ -11323,24 +8389,18 @@ selector: "newWithValues:", protocol: 'evaluating', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var object = Object.create(self.prototype); var result = self.apply(object, aCollection); return typeof result === "object" ? result : object; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11351,20 +8411,14 @@ selector: "numArgs", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.length; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "numArgs\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11376,15 +8430,11 @@ protocol: 'error handling', fn: function (anErrorClass,aBlock){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $1=self._tryCatch_((function(error){ var smalltalkError; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error); smalltalkError; $2=$recv(smalltalkError)._isKindOf_(anErrorClass); @@ -11393,20 +8443,14 @@ return $recv(aBlock)._value_(smalltalkError); } else { return $recv(smalltalkError)._resignal(); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anErrorClass", "aBlock"], source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"] }), $globals.BlockClosure); @@ -11420,11 +8464,9 @@ var self=this; return nil; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11436,21 +8478,15 @@ protocol: 'evaluating', fn: function (){ var self=this; function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Date())._millisecondsToRun_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self", referencedClasses: ["Date"], -//>>excludeEnd("ide"); messageSends: ["millisecondsToRun:"] }), $globals.BlockClosure); @@ -11461,9 +8497,7 @@ selector: "tryCatch:", protocol: 'error handling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); try { return self._value(); @@ -11474,15 +8508,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11493,20 +8523,14 @@ selector: "value", protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self();; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11517,20 +8541,14 @@ selector: "value:", protocol: 'evaluating', fn: function (anArg){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self(anArg);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArg"], source: "value: anArg\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11541,20 +8559,14 @@ selector: "value:value:", protocol: 'evaluating', fn: function (firstArg,secondArg){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self(firstArg, secondArg);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["firstArg", "secondArg"], source: "value: firstArg value: secondArg\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11565,20 +8577,14 @@ selector: "value:value:value:", protocol: 'evaluating', fn: function (firstArg,secondArg,thirdArg){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self(firstArg, secondArg, thirdArg);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["firstArg", "secondArg", "thirdArg"], source: "value: firstArg value: secondArg value: thirdArg\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11589,23 +8595,17 @@ selector: "valueWithInterval:", protocol: 'timeout/interval', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var interval = setInterval(self, aNumber); return $globals.Timeout._on_(interval); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11616,20 +8616,14 @@ selector: "valueWithPossibleArguments:", protocol: 'evaluating', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.apply(null, aCollection);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "valueWithPossibleArguments: aCollection\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11640,23 +8634,17 @@ selector: "valueWithTimeout:", protocol: 'timeout/interval', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var timeout = setTimeout(self, aNumber); return $globals.Timeout._on_(timeout); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11667,22 +8655,16 @@ selector: "whileFalse", protocol: 'controlling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._whileFalse_((function(){ })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "whileFalse\x0a\x09self whileFalse: []", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileFalse:"] }), $globals.BlockClosure); @@ -11693,20 +8675,14 @@ selector: "whileFalse:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); while(!$core.assert(self._value())) {aBlock._value()}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "whileFalse: aBlock\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11717,22 +8693,16 @@ selector: "whileTrue", protocol: 'controlling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._whileTrue_((function(){ })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "whileTrue\x0a\x09self whileTrue: []", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileTrue:"] }), $globals.BlockClosure); @@ -11743,20 +8713,14 @@ selector: "whileTrue:", protocol: 'controlling', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); while($core.assert(self._value())) {aBlock._value()}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "whileTrue: aBlock\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BlockClosure); @@ -11764,29 +8728,21 @@ $globals.BlockClosure); $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "arguments", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.args || []; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arguments\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.CompiledMethod); @@ -11798,20 +8754,14 @@ protocol: 'browsing', fn: function (){ var self=this; function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Finder())._findMethod_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "browse\x0a\x09Finder findMethod: self", referencedClasses: ["Finder"], -//>>excludeEnd("ide"); messageSends: ["findMethod:"] }), $globals.CompiledMethod); @@ -11822,21 +8772,15 @@ selector: "category", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._protocol(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "category\x0a\x09^ self protocol", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["protocol"] }), $globals.CompiledMethod); @@ -11850,11 +8794,9 @@ var self=this; return "as yet unclassified"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultProtocol\x0a\x09^ 'as yet unclassified'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.CompiledMethod); @@ -11865,21 +8807,15 @@ selector: "fn", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("fn"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fn\x0a\x09^ self basicAt: 'fn'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.CompiledMethod); @@ -11890,20 +8826,14 @@ selector: "fn:", protocol: 'accessing', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._basicAt_put_("fn",aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:put:"] }), $globals.CompiledMethod); @@ -11917,11 +8847,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isCompiledMethod\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.CompiledMethod); @@ -11933,37 +8861,27 @@ protocol: 'testing', fn: function (){ var self=this; var selector; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; var $early={}; try { selector=self._selector(); $recv(self._methodClass())._allSubclassesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(each)._includesSelector_(selector); if($core.assert($1)){ throw $early=[true]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return false; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"] }), $globals.CompiledMethod); @@ -11975,18 +8893,12 @@ protocol: 'testing', fn: function (){ var self=this; var superclass; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$receiver; $1=self._methodClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodClass"]=1; -//>>excludeEnd("ctx"); superclass=$recv($1)._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); $2=superclass; if(($receiver = $2) == null || $receiver.isNil){ return false; @@ -11995,15 +8907,11 @@ $2; }; $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil(); return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"] }), $globals.CompiledMethod); @@ -12014,21 +8922,15 @@ selector: "messageSends", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("messageSends"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "messageSends\x0a\x09^ self basicAt: 'messageSends'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.CompiledMethod); @@ -12039,21 +8941,15 @@ selector: "methodClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("methodClass"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodClass\x0a\x09^ self basicAt: 'methodClass'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.CompiledMethod); @@ -12064,9 +8960,7 @@ selector: "package", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._methodClass(); if(($receiver = $2) == null || $receiver.isNil){ @@ -12077,15 +8971,11 @@ class_=$receiver; $1=$recv(class_)._packageOfProtocol_(self._protocol()); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"] }), $globals.CompiledMethod); @@ -12096,9 +8986,7 @@ selector: "protocol", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._basicAt_("protocol"); if(($receiver = $2) == null || $receiver.isNil){ @@ -12107,15 +8995,11 @@ $1=self._defaultProtocol(); $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "basicAt:", "defaultProtocol"] }), $globals.CompiledMethod); @@ -12129,9 +9013,7 @@ var self=this; var oldProtocol; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$receiver; oldProtocol=self._protocol(); self._basicAt_put_("protocol",aString); @@ -12150,15 +9032,11 @@ $recv($recv(methodClass)._organization())._addElement_(aString); $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]", referencedClasses: ["SystemAnnouncer", "MethodMoved"], -//>>excludeEnd("ide"); messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"] }), $globals.CompiledMethod); @@ -12169,21 +9047,15 @@ selector: "referencedClasses", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("referencedClasses"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.CompiledMethod); @@ -12194,21 +9066,15 @@ selector: "selector", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("selector"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "selector\x0a\x09^ self basicAt: 'selector'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.CompiledMethod); @@ -12219,20 +9085,14 @@ selector: "selector:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._basicAt_put_("selector",aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:put:"] }), $globals.CompiledMethod); @@ -12243,21 +9103,15 @@ selector: "sendTo:arguments:", protocol: 'evaluating', fn: function (anObject,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aCollection"], source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["applyTo:arguments:", "fn"] }), $globals.CompiledMethod); @@ -12268,9 +9122,7 @@ selector: "source", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._basicAt_("source"); if(($receiver = $2) == null || $receiver.isNil){ @@ -12279,15 +9131,11 @@ $1=""; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "basicAt:"] }), $globals.CompiledMethod); @@ -12298,20 +9146,14 @@ selector: "source:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._basicAt_put_("source",aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "source: aString\x0a\x09self basicAt: 'source' put: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:put:"] }), $globals.CompiledMethod); @@ -12319,30 +9161,22 @@ $globals.CompiledMethod); $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addWorker", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@worker"])._valueWithTimeout_((0)); self["@poolSize"]=$recv(self["@poolSize"]).__plus((1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["valueWithTimeout:", "+"] }), $globals.ForkPool); @@ -12353,21 +9187,15 @@ selector: "defaultMaxPoolSize", protocol: 'defaults', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._defaultMaxPoolSize(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["defaultMaxPoolSize", "class"] }), $globals.ForkPool); @@ -12378,9 +9206,7 @@ selector: "fork:", protocol: 'actions', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize()); if($core.assert($1)){ @@ -12388,15 +9214,11 @@ self._addWorker(); }; $recv(self["@queue"])._nextPut_(aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"] }), $globals.ForkPool); @@ -12408,30 +9230,20 @@ protocol: 'initialization', fn: function (){ var self=this; function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@poolSize"]=(0); self["@queue"]=$recv($Queue())._new(); self["@worker"]=self._makeWorker(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker", referencedClasses: ["Queue"], -//>>excludeEnd("ide"); messageSends: ["initialize", "new", "makeWorker"] }), $globals.ForkPool); @@ -12444,16 +9256,12 @@ fn: function (){ var self=this; var sentinel; function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; sentinel=$recv($Object())._new(); $1=(function(){ var block; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self["@poolSize"]=$recv(self["@poolSize"]).__minus((1)); self["@poolSize"]; block=$recv(self["@queue"])._nextIfAbsent_((function(){ @@ -12464,37 +9272,23 @@ block; $2=$recv(block).__eq_eq(sentinel); if(!$core.assert($2)){ return $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(block)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)}); -//>>excludeEnd("ctx"); }))._ensure_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return self._addWorker(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)}); -//>>excludeEnd("ctx"); })); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)}); -//>>excludeEnd("ctx"); }); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]", referencedClasses: ["Object"], -//>>excludeEnd("ide"); messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"] }), $globals.ForkPool); @@ -12505,9 +9299,7 @@ selector: "maxPoolSize", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@maxPoolSize"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -12516,15 +9308,11 @@ $1=self._defaultMaxPoolSize(); $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "defaultMaxPoolSize"] }), $globals.ForkPool); @@ -12539,11 +9327,9 @@ self["@maxPoolSize"]=anInteger; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ForkPool); @@ -12556,9 +9342,7 @@ selector: "default", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@default"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -12568,15 +9352,11 @@ $1=self["@default"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "default\x0a\x09^ default ifNil: [ default := self new ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.ForkPool.klass); @@ -12590,11 +9370,9 @@ var self=this; return (100); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultMaxPoolSize\x0a\x09^ 100", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ForkPool.klass); @@ -12609,20 +9387,16 @@ self["@default"]=nil; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "resetDefault\x0a\x09default := nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ForkPool.klass); $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "arguments", @@ -12634,11 +9408,9 @@ $1=self["@arguments"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arguments\x0a\x09^ arguments", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Message); @@ -12653,11 +9425,9 @@ self["@arguments"]=anArray; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArray"], source: "arguments: anArray\x0a\x09arguments := anArray", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Message); @@ -12668,37 +9438,23 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $recv(aStream)._nextPutAll_("("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "selector"] }), $globals.Message); @@ -12714,11 +9470,9 @@ $1=self["@selector"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "selector\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Message); @@ -12733,11 +9487,9 @@ self["@selector"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "selector: aString\x0a\x09selector := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Message); @@ -12748,21 +9500,15 @@ selector: "sendTo:", protocol: 'actions', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["perform:withArguments:", "selector", "arguments"] }), $globals.Message); @@ -12774,9 +9520,7 @@ selector: "selector:arguments:", protocol: 'instance creation', fn: function (aString,anArray){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._selector_(aString); @@ -12784,45 +9528,33 @@ $recv($2)._arguments_(anArray); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anArray"], source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["selector:", "new", "arguments:", "yourself"] }), $globals.Message.klass); $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "arguments", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@message"])._arguments(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "arguments\x0a\x09^ message arguments", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments"] }), $globals.MessageSend); @@ -12833,20 +9565,14 @@ selector: "arguments:", protocol: 'accessing', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@message"])._arguments_(aCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "arguments: aCollection\x0a\x09message arguments: aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments:"] }), $globals.MessageSend); @@ -12858,28 +9584,18 @@ protocol: 'initialization', fn: function (){ var self=this; function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@message"]=$recv($Message())._new(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new", referencedClasses: ["Message"], -//>>excludeEnd("ide"); messageSends: ["initialize", "new"] }), $globals.MessageSend); @@ -12890,45 +9606,27 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $recv(aStream)._nextPutAll_("("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._receiver()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(" >> "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"] }), $globals.MessageSend); @@ -12944,11 +9642,9 @@ $1=self["@receiver"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageSend); @@ -12963,11 +9659,9 @@ self["@receiver"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "receiver: anObject\x0a\x09receiver := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageSend); @@ -12978,21 +9672,15 @@ selector: "selector", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@message"])._selector(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "selector\x0a\x09^ message selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["selector"] }), $globals.MessageSend); @@ -13003,20 +9691,14 @@ selector: "selector:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@message"])._selector_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "selector: aString\x0a\x09message selector: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["selector:"] }), $globals.MessageSend); @@ -13027,21 +9709,15 @@ selector: "value", protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@message"])._sendTo_(self._receiver()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09^ message sendTo: self receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sendTo:", "receiver"] }), $globals.MessageSend); @@ -13052,24 +9728,18 @@ selector: "value:", protocol: 'evaluating', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self["@message"]; $recv($2)._arguments_([anObject]); $3=$recv($2)._sendTo_(self._receiver()); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments:", "sendTo:", "receiver"] }), $globals.MessageSend); @@ -13080,24 +9750,18 @@ selector: "value:value:", protocol: 'evaluating', fn: function (firstArgument,secondArgument){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self["@message"]; $recv($2)._arguments_([firstArgument,secondArgument]); $3=$recv($2)._sendTo_(self._receiver()); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["firstArgument", "secondArgument"], source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments:", "sendTo:", "receiver"] }), $globals.MessageSend); @@ -13108,24 +9772,18 @@ selector: "value:value:value:", protocol: 'evaluating', fn: function (firstArgument,secondArgument,thirdArgument){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self["@message"]; $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]); $3=$recv($2)._sendTo_(self._receiver()); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["firstArgument", "secondArgument", "thirdArgument"], source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments:", "sendTo:", "receiver"] }), $globals.MessageSend); @@ -13136,22 +9794,16 @@ selector: "valueWithPossibleArguments:", protocol: 'evaluating', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; self._arguments_(aCollection); $1=self._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["arguments:", "value"] }), $globals.MessageSend); @@ -13159,98 +9811,62 @@ $globals.MessageSend); $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1; $2=self._isBlockContext(); if($core.assert($2)){ $3="a block (in ".__comma($recv(self._methodContext())._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $1=$recv($3).__comma(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); } else { var methodClass; methodClass=$recv(self._method())._methodClass(); methodClass; $5=methodClass; $7=self._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); $6=$recv($7)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $4=$recv($5).__eq($6); if($core.assert($4)){ $11=self._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["receiver"]=2; -//>>excludeEnd("ctx"); $10=$recv($11)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=2; -//>>excludeEnd("ctx"); $9=$recv($10)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $8=$recv($9).__comma(" >> "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); $12=self._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); $1=$recv($8).__comma($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); } else { $16=$recv($recv(self._receiver())._class())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=2; -//>>excludeEnd("ctx"); $15=$recv($16).__comma("("); $14=$recv($15).__comma($recv(methodClass)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=7; -//>>excludeEnd("ctx"); $13=$recv($14).__comma(") >> "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); $1=$recv($13).__comma(self._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); }; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"] }), $globals.MethodContext); @@ -13261,20 +9877,14 @@ selector: "basicReceiver", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.receiver; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basicReceiver\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13285,20 +9895,14 @@ selector: "evaluatedSelector", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.evaluatedSelector; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "evaluatedSelector\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13310,25 +9914,17 @@ protocol: 'accessing', fn: function (testBlock){ var self=this; var context; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; var $early={}; try { context=self; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(context)._isNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(testBlock)._value_(context); if($core.assert($1)){ $2=context; @@ -13336,22 +9932,16 @@ throw $early=[$2]; }; context=$recv(context)._outerContext(); return context; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return nil; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["testBlock"], source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"] }), $globals.MethodContext); @@ -13362,20 +9952,14 @@ selector: "home", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.homeContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "home\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13386,20 +9970,14 @@ selector: "index", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.index || 0; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "index\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13410,21 +9988,15 @@ selector: "isBlockContext", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._selector())._isNil(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["isNil", "selector"] }), $globals.MethodContext); @@ -13435,20 +10007,14 @@ selector: "locals", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.locals || {}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "locals\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13460,38 +10026,26 @@ protocol: 'accessing', fn: function (){ var self=this; var method,lookupClass,receiverClass,supercall; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver; $1=self._methodContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodContext"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ return nil; } else { $1; }; $3=self._methodContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodContext"]=2; -//>>excludeEnd("ctx"); $2=$recv($3)._receiver(); receiverClass=$recv($2)._class(); $4=receiverClass; $6=self._methodContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodContext"]=3; -//>>excludeEnd("ctx"); $5=$recv($6)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); method=$recv($4)._lookupSelector_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["lookupSelector:"]=1; -//>>excludeEnd("ctx"); $7=self._outerContext(); if(($receiver = $7) == null || $receiver.isNil){ supercall=false; @@ -13507,15 +10061,11 @@ $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($re $8=method; }; return $8; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"] }), $globals.MethodContext); @@ -13526,9 +10076,7 @@ selector: "methodContext", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$2,$receiver; $1=self._isBlockContext(); if(!$core.assert($1)){ @@ -13543,15 +10091,11 @@ outer=$receiver; $2=$recv(outer)._methodContext(); }; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"] }), $globals.MethodContext); @@ -13562,20 +10106,14 @@ selector: "outerContext", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.outerContext || self.homeContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "outerContext\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13586,37 +10124,23 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $recv(aStream)._nextPutAll_("("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "asString"] }), $globals.MethodContext); @@ -13627,22 +10151,14 @@ selector: "receiver", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $2=$recv(self._isBlockContext())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=self._outerContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["outerContext"]=1; -//>>excludeEnd("ctx"); return $recv($3)._notNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); if($core.assert($2)){ $1=$recv(self._outerContext())._receiver(); @@ -13650,15 +10166,11 @@ $1=$recv(self._outerContext())._receiver(); $1=self._basicReceiver(); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"] }), $globals.MethodContext); @@ -13669,9 +10181,7 @@ selector: "selector", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self.selector) { return $core.js2st(self.selector); @@ -13680,15 +10190,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13699,20 +10205,14 @@ selector: "sendIndexAt:", protocol: 'accessing', fn: function (aSelector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.sendIdx[aSelector] || 0; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aSelector"], source: "sendIndexAt: aSelector\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13723,20 +10223,14 @@ selector: "sendIndexes", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.sendIdx; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sendIndexes\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13747,20 +10241,14 @@ selector: "supercall", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.supercall == true; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "supercall\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodContext); @@ -13768,9 +10256,7 @@ $globals.MethodContext); $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -13778,24 +10264,18 @@ selector: "constructor:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._deprecatedAPI_("Use constructorNamed:"); var nativeFunc=eval(aString); return new nativeFunc(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13806,24 +10286,18 @@ selector: "constructor:value:", protocol: 'instance creation', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._deprecatedAPI_("Use constructorNamed:value:"); var nativeFunc=eval(aString); return new nativeFunc(anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13834,24 +10308,18 @@ selector: "constructor:value:value:", protocol: 'instance creation', fn: function (aString,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._deprecatedAPI_("Use constructorNamed:value:value:"); var nativeFunc=eval(aString); return new nativeFunc(anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2"], source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13862,24 +10330,18 @@ selector: "constructor:value:value:value:", protocol: 'instance creation', fn: function (aString,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._deprecatedAPI_("Use constructorNamed:value:value:value"); var nativeFunc=eval(aString); return new nativeFunc(anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2", "anObject3"], source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13890,23 +10352,17 @@ selector: "constructorNamed:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return new nativeFunc(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13917,23 +10373,17 @@ selector: "constructorNamed:value:", protocol: 'instance creation', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return new nativeFunc(anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13944,23 +10394,17 @@ selector: "constructorNamed:value:value:", protocol: 'instance creation', fn: function (aString,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return new nativeFunc(anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2"], source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13971,23 +10415,17 @@ selector: "constructorNamed:value:value:value:", protocol: 'instance creation', fn: function (aString,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return new nativeFunc(anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2", "anObject3"], source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -13998,22 +10436,16 @@ selector: "constructorOf:", protocol: 'instance creation', fn: function (nativeFunc){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new nativeFunc(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc"], source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14024,22 +10456,16 @@ selector: "constructorOf:value:", protocol: 'instance creation', fn: function (nativeFunc,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new nativeFunc(anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject"], source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14050,22 +10476,16 @@ selector: "constructorOf:value:value:", protocol: 'instance creation', fn: function (nativeFunc,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new nativeFunc(anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject", "anObject2"], source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14076,22 +10496,16 @@ selector: "constructorOf:value:value:value:", protocol: 'instance creation', fn: function (nativeFunc,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new nativeFunc(anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject", "anObject2", "anObject3"], source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14102,23 +10516,17 @@ selector: "exists:", protocol: 'testing', fn: function (aString){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($PlatformInterface())._existsGlobal_(aString); +$1=$recv($Smalltalk())._existsJsGlobal_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString", -referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); -messageSends: ["existsGlobal:"] +source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString", +referencedClasses: ["Smalltalk"], +messageSends: ["existsJsGlobal:"] }), $globals.NativeFunction.klass); @@ -14128,23 +10536,17 @@ selector: "functionNamed:", protocol: 'function calling', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return nativeFunc(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14155,23 +10557,17 @@ selector: "functionNamed:value:", protocol: 'function calling', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return nativeFunc(anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14182,23 +10578,17 @@ selector: "functionNamed:value:value:", protocol: 'function calling', fn: function (aString,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return nativeFunc(anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2"], source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14209,23 +10599,17 @@ selector: "functionNamed:value:value:value:", protocol: 'function calling', fn: function (aString,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return nativeFunc(anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "anObject2", "anObject3"], source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14236,23 +10620,17 @@ selector: "functionNamed:valueWithArgs:", protocol: 'function calling', fn: function (aString,args){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var nativeFunc=(new Function('return this'))()[aString]; return Function.prototype.apply.call(nativeFunc, null, args); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "args"], source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14263,22 +10641,16 @@ selector: "functionOf:", protocol: 'function calling', fn: function (nativeFunc){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return nativeFunc(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc"], source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14289,22 +10661,16 @@ selector: "functionOf:value:", protocol: 'function calling', fn: function (nativeFunc,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return nativeFunc(anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject"], source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14315,22 +10681,16 @@ selector: "functionOf:value:value:", protocol: 'function calling', fn: function (nativeFunc,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return nativeFunc(anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject", "anObject2"], source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14341,22 +10701,16 @@ selector: "functionOf:value:value:value:", protocol: 'function calling', fn: function (nativeFunc,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return nativeFunc(anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "anObject", "anObject2", "anObject3"], source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14367,22 +10721,16 @@ selector: "functionOf:valueWithArgs:", protocol: 'function calling', fn: function (nativeFunc,args){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.apply.call(nativeFunc, null, args); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "args"], source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14393,22 +10741,16 @@ selector: "methodOf:this:", protocol: 'method calling', fn: function (nativeFunc,thisObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.call.call(nativeFunc, thisObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "thisObject"], source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14419,22 +10761,16 @@ selector: "methodOf:this:value:", protocol: 'method calling', fn: function (nativeFunc,thisObject,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.call.call(nativeFunc, thisObject, anObject); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "thisObject", "anObject"], source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14445,22 +10781,16 @@ selector: "methodOf:this:value:value:", protocol: 'method calling', fn: function (nativeFunc,thisObject,anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "thisObject", "anObject", "anObject2"], source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14471,22 +10801,16 @@ selector: "methodOf:this:value:value:value:", protocol: 'method calling', fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"], source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); @@ -14497,54 +10821,40 @@ selector: "methodOf:this:valueWithArgs:", protocol: 'method calling', fn: function (nativeFunc,thisObject,args){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Function.prototype.apply.call(nativeFunc, thisObject, args); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["nativeFunc", "thisObject", "args"], source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NativeFunction.klass); $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "clearInterval", protocol: 'timeout/interval', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var interval = self["@rawTimeout"]; clearInterval(interval); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Timeout); @@ -14555,23 +10865,17 @@ selector: "clearTimeout", protocol: 'timeout/interval', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var timeout = self["@rawTimeout"]; clearTimeout(timeout); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Timeout); @@ -14586,11 +10890,9 @@ self["@rawTimeout"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Timeout); @@ -14602,24 +10904,18 @@ selector: "on:", protocol: 'instance creation', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._rawTimeout_(anObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["rawTimeout:", "new", "yourself"] }), $globals.Timeout.klass); @@ -14633,69 +10929,41 @@ $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(e $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: 'comparing', fn: function (anAssociation){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$5,$4,$6,$1; $3=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__eq($recv(anAssociation)._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $5=self._key(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["key"]=1; -//>>excludeEnd("ctx"); $4=$recv($5).__eq($recv(anAssociation)._key()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["="]=2; -//>>excludeEnd("ctx"); return $recv($4)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); $6=self._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["value"]=1; -//>>excludeEnd("ctx"); return $recv($6).__eq($recv(anAssociation)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAssociation"], source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", "=", "class", "key", "value"] }), $globals.Association); @@ -14711,11 +10979,9 @@ $1=self["@key"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "key\x0a\x09^ key", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Association); @@ -14730,11 +10996,9 @@ self["@key"]=aKey; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "key: aKey\x0a\x09key := aKey", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Association); @@ -14745,25 +11009,17 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._key())._printOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["printOn:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(" -> "); $recv(self._value())._printOn_(aStream); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "key", "nextPutAll:", "value"] }), $globals.Association); @@ -14779,11 +11035,9 @@ $1=self["@value"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09^ value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Association); @@ -14798,11 +11052,9 @@ self["@value"]=aValue; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aValue"], source: "value: aValue\x0a\x09value := aValue", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Association); @@ -14814,9 +11066,7 @@ selector: "key:value:", protocol: 'instance creation', fn: function (aKey,aValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._key_(aKey); @@ -14824,33 +11074,25 @@ $recv($2)._value_(aValue); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aValue"], source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["key:", "new", "value:", "yourself"] }), $globals.Association.klass); $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "bucketOfElement:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var hash = self['@hashBlock'](anObject); if (!hash) return null; @@ -14860,15 +11102,11 @@ return $core.withContext(function($ctx1) { return bucket; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BucketStore); @@ -14879,24 +11117,18 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var buckets = self['@buckets']; var keys = Object.keys(buckets); for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BucketStore); @@ -14911,11 +11143,9 @@ self["@hashBlock"]=aBlock; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BucketStore); @@ -14926,28 +11156,18 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self._removeAll(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "removeAll"] }), $globals.BucketStore); @@ -14958,20 +11178,14 @@ selector: "newBucket", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "newBucket\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.BucketStore); @@ -14982,20 +11196,14 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self['@buckets'] = Object.create(null);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BucketStore); @@ -15007,33 +11215,25 @@ selector: "hashBlock:", protocol: 'instance creation', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._hashBlock_(aBlock); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["hashBlock:", "new", "yourself"] }), $globals.BucketStore.klass); $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "newBucket", @@ -15045,11 +11245,9 @@ $1=[]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "newBucket\x0a\x09^ #()", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ArrayBucketStore); @@ -15057,33 +11255,25 @@ $globals.ArrayBucketStore); $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: ",", protocol: 'copying', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._copy(); $recv($2)._addAll_(aCollection); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addAll:", "copy", "yourself"] }), $globals.Collection); @@ -15094,20 +11284,14 @@ selector: "add:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "add: anObject\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -15118,28 +11302,18 @@ selector: "addAll:", protocol: 'adding/removing', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return aCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "add:"] }), $globals.Collection); @@ -15150,36 +11324,26 @@ selector: "allSatisfy:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; var $early={}; try { self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(each); if(!$core.assert($1)){ throw $early=[false]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return true; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifFalse:", "value:"] }), $globals.Collection); @@ -15190,19 +11354,13 @@ selector: "anyOne", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $early={}; try { self._ifEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._error_("Collection is empty"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); self._do_((function(each){ throw $early=[each]; @@ -15211,15 +11369,11 @@ throw $early=[each]; return self; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifEmpty:", "error:", "do:"] }), $globals.Collection); @@ -15230,36 +11384,26 @@ selector: "anySatisfy:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; var $early={}; try { self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(each); if($core.assert($1)){ throw $early=[true]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return false; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifTrue:", "value:"] }), $globals.Collection); @@ -15271,21 +11415,15 @@ protocol: 'converting', fn: function (){ var self=this; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Array())._withAll_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asArray\x0a\x09^ Array withAll: self", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["withAll:"] }), $globals.Collection); @@ -15296,29 +11434,19 @@ selector: "asJSON", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._asArray())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._asJSON(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "asArray", "asJSON"] }), $globals.Collection); @@ -15329,21 +11457,15 @@ selector: "asOrderedCollection", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._asArray(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asOrderedCollection\x0a\x09^ self asArray", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asArray"] }), $globals.Collection); @@ -15355,21 +11477,15 @@ protocol: 'converting', fn: function (){ var self=this; function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Set())._withAll_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asSet\x0a\x09^ Set withAll: self", referencedClasses: ["Set"], -//>>excludeEnd("ide"); messageSends: ["withAll:"] }), $globals.Collection); @@ -15381,31 +11497,21 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; stream=$recv($recv(self._class())._new())._writeStream(); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPut_($recv(aBlock)._value_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=$recv(stream)._contents(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"] }), $globals.Collection); @@ -15416,24 +11522,18 @@ selector: "copyWith:", protocol: 'copying', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._copy(); $recv($2)._add_(anObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "copy", "yourself"] }), $globals.Collection); @@ -15444,24 +11544,18 @@ selector: "copyWithAll:", protocol: 'copying', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._copy(); $recv($2)._addAll_(aCollection); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addAll:", "copy", "yourself"] }), $globals.Collection); @@ -15472,29 +11566,19 @@ selector: "copyWithoutAll:", protocol: 'copying', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._reject_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aCollection)._includes_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["reject:", "includes:"] }), $globals.Collection); @@ -15505,29 +11589,19 @@ selector: "detect:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._detect_ifNone_(aBlock,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._errorNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["detect:ifNone:", "errorNotFound"] }), $globals.Collection); @@ -15538,20 +11612,14 @@ selector: "detect:ifNone:", protocol: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -15562,20 +11630,14 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -15587,34 +11649,24 @@ protocol: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; var actionBeforeElement; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); actionBeforeElement=(function(){ actionBeforeElement=anotherBlock; return actionBeforeElement; }); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(actionBeforeElement)._value(); return $recv(aBlock)._value_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "value", "value:"] }), $globals.Collection); @@ -15625,20 +11677,14 @@ selector: "errorNotFound", protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("Object is not in the collection"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:"] }), $globals.Collection); @@ -15649,9 +11695,7 @@ selector: "ifEmpty:", protocol: 'testing', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._isEmpty(); $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){ @@ -15659,15 +11703,11 @@ return self; })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isEmpty"] }), $globals.Collection); @@ -15678,30 +11718,20 @@ selector: "ifEmpty:ifNotEmpty:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._isEmpty(); $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(anotherBlock)._value_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"] }), $globals.Collection); @@ -15712,9 +11742,7 @@ selector: "ifNotEmpty:", protocol: 'testing', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._notEmpty(); if($core.assert($2)){ @@ -15723,15 +11751,11 @@ $1=$recv(aBlock)._value_(self); $1=self; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"] }), $globals.Collection); @@ -15742,30 +11766,20 @@ selector: "ifNotEmpty:ifEmpty:", protocol: 'testing', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._notEmpty(); $1=$recv($2)._ifTrue_ifFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),anotherBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"] }), $globals.Collection); @@ -15776,29 +11790,19 @@ selector: "includes:", protocol: 'testing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._anySatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each).__eq(anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["anySatisfy:", "="] }), $globals.Collection); @@ -15810,32 +11814,22 @@ protocol: 'enumerating', fn: function (anObject,aBlock){ var self=this; var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; result=anObject; self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); result=$recv(aBlock)._value_value_(result,each); return result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=result; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "value:value:"] }), $globals.Collection); @@ -15848,47 +11842,31 @@ fn: function (aCollection){ var self=this; var set,outputSet; function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3; set=self._asSet(); outputSet=$recv($Set())._new(); $recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(set)._includes_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["includes:"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv($recv(outputSet)._includes_(each))._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); if($core.assert($1)){ return $recv(outputSet)._add_(each); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $3=$recv(self._class())._withAll_($recv(outputSet)._asArray()); return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray", referencedClasses: ["Set"], -//>>excludeEnd("ide"); messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"] }), $globals.Collection); @@ -15899,21 +11877,15 @@ selector: "isEmpty", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._size()).__eq((0)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isEmpty\x0a\x09^ self size = 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=", "size"] }), $globals.Collection); @@ -15924,36 +11896,26 @@ selector: "noneSatisfy:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; var $early={}; try { self._do_((function(item){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(item); if($core.assert($1)){ throw $early=[false]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return true; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifTrue:", "value:"] }), $globals.Collection); @@ -15964,21 +11926,15 @@ selector: "notEmpty", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._isEmpty())._not(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "notEmpty\x0a\x09^ self isEmpty not", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["not", "isEmpty"] }), $globals.Collection); @@ -15990,35 +11946,25 @@ protocol: 'accessing', fn: function (anObject){ var self=this; var tally; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; tally=(0); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(anObject).__eq(each); if($core.assert($1)){ tally=$recv(tally).__plus((1)); return tally; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=tally; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifTrue:", "=", "+"] }), $globals.Collection); @@ -16029,28 +11975,18 @@ selector: "putOn:", protocol: 'streaming', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._putOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "putOn:"] }), $globals.Collection); @@ -16061,29 +11997,19 @@ selector: "reject:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(aBlock)._value_(each)).__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["select:", "=", "value:"] }), $globals.Collection); @@ -16094,29 +12020,19 @@ selector: "remove:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._remove_ifAbsent_(anObject,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._errorNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["remove:ifAbsent:", "errorNotFound"] }), $globals.Collection); @@ -16127,20 +12043,14 @@ selector: "remove:ifAbsent:", protocol: 'adding/removing', fn: function (anObject,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -16151,20 +12061,14 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -16176,34 +12080,24 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; stream=$recv($recv(self._class())._new())._writeStream(); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(each); if($core.assert($1)){ return $recv(stream)._nextPut_(each); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=$recv(stream)._contents(); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"] }), $globals.Collection); @@ -16215,37 +12109,25 @@ protocol: 'enumerating', fn: function (selectBlock,collectBlock){ var self=this; var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; stream=$recv($recv(self._class())._new())._writeStream(); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(selectBlock)._value_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); if($core.assert($1)){ return $recv(stream)._nextPut_($recv(collectBlock)._value_(each)); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=$recv(stream)._contents(); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["selectBlock", "collectBlock"], source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"] }), $globals.Collection); @@ -16256,20 +12138,14 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.Collection); @@ -16284,11 +12160,9 @@ var self=this; return "collection"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Collection.klass); @@ -16299,21 +12173,15 @@ selector: "new:", protocol: 'instance creation', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "new: anInteger\x0a\x09^ self new", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new"] }), $globals.Collection.klass); @@ -16324,24 +12192,18 @@ selector: "with:", protocol: 'instance creation', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._add_(anObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "new", "yourself"] }), $globals.Collection.klass); @@ -16352,28 +12214,20 @@ selector: "with:with:", protocol: 'instance creation', fn: function (anObject,anotherObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._add_(anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); $recv($2)._add_(anotherObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anotherObject"], source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "new", "yourself"] }), $globals.Collection.klass); @@ -16384,32 +12238,22 @@ selector: "with:with:with:", protocol: 'instance creation', fn: function (firstObject,secondObject,thirdObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._add_(firstObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); $recv($2)._add_(secondObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); $recv($2)._add_(thirdObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["firstObject", "secondObject", "thirdObject"], source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "new", "yourself"] }), $globals.Collection.klass); @@ -16420,62 +12264,44 @@ selector: "withAll:", protocol: 'instance creation', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._addAll_(aCollection); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addAll:", "new", "yourself"] }), $globals.Collection.klass); $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "at:", protocol: 'accessing', fn: function (anIndex){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_ifAbsent_(anIndex,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._errorNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex"], source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "errorNotFound"] }), $globals.IndexableCollection); @@ -16486,20 +12312,14 @@ selector: "at:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.IndexableCollection); @@ -16510,29 +12330,19 @@ selector: "at:ifAbsentPut:", protocol: 'accessing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_ifAbsent_(aKey,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._at_put_(aKey,$recv(aBlock)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "at:put:", "value"] }), $globals.IndexableCollection); @@ -16543,24 +12353,18 @@ selector: "at:ifPresent:", protocol: 'accessing', fn: function (anIndex,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){ return nil; })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock"], source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:ifPresent:ifAbsent:"] }), $globals.IndexableCollection); @@ -16571,20 +12375,14 @@ selector: "at:ifPresent:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock", "anotherBlock"], source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.IndexableCollection); @@ -16595,20 +12393,14 @@ selector: "at:put:", protocol: 'accessing', fn: function (anIndex,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.IndexableCollection); @@ -16619,29 +12411,19 @@ selector: "indexOf:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._indexOf_ifAbsent_(anObject,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._errorNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["indexOf:ifAbsent:", "errorNotFound"] }), $globals.IndexableCollection); @@ -16652,20 +12434,14 @@ selector: "indexOf:ifAbsent:", protocol: 'accessing', fn: function (anObject,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.IndexableCollection); @@ -16676,28 +12452,18 @@ selector: "with:do:", protocol: 'enumerating', fn: function (anotherCollection,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._withIndexDo_((function(each,index){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anotherCollection", "aBlock"], source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["withIndexDo:", "value:value:", "at:"] }), $globals.IndexableCollection); @@ -16708,20 +12474,14 @@ selector: "withIndexDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.IndexableCollection); @@ -16729,56 +12489,38 @@ $globals.IndexableCollection); $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: 'comparing', fn: function (anAssocitativeCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$4,$3,$6,$5; $2=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__eq($recv(anAssocitativeCollection)._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); if(!$core.assert($1)){ return false; }; $4=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__eq($recv(anAssocitativeCollection)._size()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); if(!$core.assert($3)){ return false; }; $6=self._associations(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["associations"]=1; -//>>excludeEnd("ctx"); $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations()); return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAssocitativeCollection"], source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "=", "class", "size", "associations"] }), $globals.AssociativeCollection); @@ -16789,20 +12531,14 @@ selector: "add:", protocol: 'adding/removing', fn: function (anAssociation){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAssociation"], source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:put:", "key", "value"] }), $globals.AssociativeCollection); @@ -16813,27 +12549,17 @@ selector: "addAll:", protocol: 'adding/removing', fn: function (anAssociativeCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; return anAssociativeCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAssociativeCollection"], source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addAll:", "associations"] }), $globals.AssociativeCollection); @@ -16845,21 +12571,15 @@ protocol: 'converting', fn: function (){ var self=this; function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Dictionary())._from_(self._associations()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asDictionary\x0a\x09^ Dictionary from: self associations", referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); messageSends: ["from:", "associations"] }), $globals.AssociativeCollection); @@ -16871,21 +12591,15 @@ protocol: 'converting', fn: function (){ var self=this; function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($HashedCollection())._from_(self._associations()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations", referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); messageSends: ["from:", "associations"] }), $globals.AssociativeCollection); @@ -16898,31 +12612,21 @@ fn: function (){ var self=this; var hash; function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; hash=$recv($HashedCollection())._new(); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(hash)._at_put_(key,$recv(value)._asJSON()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=hash; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash", referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"] }), $globals.AssociativeCollection); @@ -16934,31 +12638,21 @@ protocol: 'accessing', fn: function (){ var self=this; var associations; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; associations=[]; self._associationsDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(associations)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=associations; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["associationsDo:", "add:"] }), $globals.AssociativeCollection); @@ -16970,28 +12664,18 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_($recv($Association())._key_value_(key,value)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]", referencedClasses: ["Association"], -//>>excludeEnd("ide"); messageSends: ["keysAndValuesDo:", "value:", "key:value:"] }), $globals.AssociativeCollection); @@ -17002,9 +12686,7 @@ selector: "at:ifPresent:ifAbsent:", protocol: 'accessing', fn: function (aKey,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._includesKey_(aKey); if($core.assert($2)){ @@ -17013,15 +12695,11 @@ $1=$recv(aBlock)._value_(self._at_(aKey)); $1=$recv(anotherBlock)._value(); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock", "anotherBlock"], source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"] }), $globals.AssociativeCollection); @@ -17033,31 +12711,21 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var newDict; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; newDict=$recv(self._class())._new(); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=newDict; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"] }), $globals.AssociativeCollection); @@ -17069,31 +12737,21 @@ protocol: 'copying', fn: function (){ var self=this; var copy; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; copy=$recv(self._class())._new(); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(copy)._at_put_(key,$recv(value)._deepCopy()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=copy; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"] }), $globals.AssociativeCollection); @@ -17104,21 +12762,15 @@ selector: "detect:ifNone:", protocol: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["detect:ifNone:", "values"] }), $globals.AssociativeCollection); @@ -17129,20 +12781,14 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._valuesDo_(aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09self valuesDo: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["valuesDo:"] }), $globals.AssociativeCollection); @@ -17153,21 +12799,15 @@ selector: "includes:", protocol: 'enumerating', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._values())._includes_(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "includes: anObject\x0a\x09^ self values includes: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["includes:", "values"] }), $globals.AssociativeCollection); @@ -17178,20 +12818,14 @@ selector: "includesKey:", protocol: 'testing', fn: function (aKey){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "includesKey: aKey\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17202,29 +12836,19 @@ selector: "indexOf:ifAbsent:", protocol: 'accessing', fn: function (anObject,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._keys())._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._at_(each)).__eq(anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["detect:ifNone:", "keys", "=", "at:"] }), $globals.AssociativeCollection); @@ -17235,29 +12859,19 @@ selector: "keyAtValue:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._keyAtValue_ifAbsent_(anObject,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._errorNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"] }), $globals.AssociativeCollection); @@ -17268,21 +12882,15 @@ selector: "keyAtValue:ifAbsent:", protocol: 'accessing', fn: function (anObject,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._indexOf_ifAbsent_(anObject,aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["indexOf:ifAbsent:"] }), $globals.AssociativeCollection); @@ -17293,20 +12901,14 @@ selector: "keys", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "keys\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17317,28 +12919,18 @@ selector: "keysAndValuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._keysDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_value_(each,self._at_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["keysDo:", "value:value:", "at:"] }), $globals.AssociativeCollection); @@ -17349,20 +12941,14 @@ selector: "keysDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysDo: aBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17373,55 +12959,31 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["printOn:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(" ("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(self._associations())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._printOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aStream)._nextPutAll_(" , "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"] }), $globals.AssociativeCollection); @@ -17432,21 +12994,15 @@ selector: "remove:ifAbsent:", protocol: 'adding/removing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._removeKey_ifAbsent_(aKey,aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["removeKey:ifAbsent:"] }), $globals.AssociativeCollection); @@ -17457,29 +13013,19 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._keys())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._removeKey_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "keys", "removeKey:"] }), $globals.AssociativeCollection); @@ -17490,21 +13036,15 @@ selector: "removeKey:", protocol: 'adding/removing', fn: function (aKey){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._remove_(aKey); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "removeKey: aKey\x0a\x09^ self remove: aKey", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["remove:"] }), $globals.AssociativeCollection); @@ -17515,20 +13055,14 @@ selector: "removeKey:ifAbsent:", protocol: 'adding/removing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17540,34 +13074,24 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var newDict; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; newDict=$recv(self._class())._new(); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(value); if($core.assert($1)){ return $recv(newDict)._at_put_(key,value); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=newDict; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"] }), $globals.AssociativeCollection); @@ -17579,31 +13103,21 @@ protocol: 'copying', fn: function (){ var self=this; var copy; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; copy=$recv(self._class())._new(); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(copy)._at_put_(key,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=copy; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"] }), $globals.AssociativeCollection); @@ -17614,21 +13128,15 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._keys())._size(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09^ self keys size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["size", "keys"] }), $globals.AssociativeCollection); @@ -17639,20 +13147,14 @@ selector: "values", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "values\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17663,20 +13165,14 @@ selector: "valuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "valuesDo: aBlock\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.AssociativeCollection); @@ -17687,28 +13183,18 @@ selector: "withIndexDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_value_(value,key); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["keysAndValuesDo:", "value:value:"] }), $globals.AssociativeCollection); @@ -17721,31 +13207,21 @@ protocol: 'instance creation', fn: function (aCollection){ var self=this; var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; newCollection=self._new(); $recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newCollection)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=newCollection; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "do:", "add:"] }), $globals.AssociativeCollection.klass); @@ -17756,21 +13232,15 @@ selector: "fromPairs:", protocol: 'instance creation', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._from_(aCollection); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["from:"] }), $globals.AssociativeCollection.klass); @@ -17782,76 +13252,54 @@ protocol: 'instance creation', fn: function (aCollection){ var self=this; var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$4,$5; $2=$recv(aCollection)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._even(); if(!$core.assert($1)){ self._error_("#newFromPairs only accepts arrays of an even length"); }; newCollection=self._new(); $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=newCollection; $4=$recv(aCollection)._at_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1)))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $5=newCollection; return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"] }), $globals.AssociativeCollection.klass); $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "at:ifAbsent:", protocol: 'accessing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var index = self._positionOfKey_(aKey); return index >=0 ? self['@values'][index] : aBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -17862,9 +13310,7 @@ selector: "at:put:", protocol: 'accessing', fn: function (aKey,aValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var index = self._positionOfKey_(aKey); if(index === -1) { @@ -17876,15 +13322,11 @@ return $core.withContext(function($ctx1) { return self['@values'][index] = aValue; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aValue"], source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -17895,20 +13337,14 @@ selector: "includesKey:", protocol: 'testing', fn: function (aKey){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self._positionOfKey_(aKey) >= 0; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -17920,9 +13356,7 @@ protocol: 'accessing', fn: function (anObject,aBlock){ var self=this; var index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){ return (0); @@ -17935,15 +13369,11 @@ $1=$recv(aBlock)._value(); $1=$recv(self["@keys"])._at_(index); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"] }), $globals.Dictionary); @@ -17954,29 +13384,19 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@keys"]=[]; self["@values"]=[]; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize"] }), $globals.Dictionary); @@ -17987,21 +13407,15 @@ selector: "keys", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@keys"])._copy(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "keys\x0a\x09^ keys copy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copy"] }), $globals.Dictionary); @@ -18012,21 +13426,15 @@ selector: "keysAndValuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["with:do:"] }), $globals.Dictionary); @@ -18037,21 +13445,15 @@ selector: "keysDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@keys"])._do_(aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysDo: aBlock\x0a\x09^ keys do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:"] }), $globals.Dictionary); @@ -18062,9 +13464,7 @@ selector: "positionOfKey:", protocol: 'private', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var keys = self['@keys']; for(var i=0;i>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -18092,24 +13488,16 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@keys"])._removeAll(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["removeAll"]=1; -//>>excludeEnd("ctx"); $recv(self["@values"])._removeAll(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["removeAll"] }), $globals.Dictionary); @@ -18120,9 +13508,7 @@ selector: "removeKey:ifAbsent:", protocol: 'adding/removing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var index = self._positionOfKey_(aKey); if(index === -1) { @@ -18138,15 +13524,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -18162,11 +13544,9 @@ $1=self["@values"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "values\x0a\x09^ values", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Dictionary); @@ -18177,21 +13557,15 @@ selector: "valuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@values"])._do_(aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "valuesDo: aBlock\x0a\x09^ values do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:"] }), $globals.Dictionary); @@ -18199,18 +13573,14 @@ $globals.Dictionary); $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "at:ifAbsent:", protocol: 'accessing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._includesKey_(aKey); if($core.assert($2)){ @@ -18219,15 +13589,11 @@ $1=self._basicAt_(aKey); $1=$recv(aBlock)._value(); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"] }), $globals.HashedCollection); @@ -18238,21 +13604,15 @@ selector: "at:put:", protocol: 'accessing', fn: function (aKey,aValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_put_(aKey,aValue); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aValue"], source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:put:"] }), $globals.HashedCollection); @@ -18263,20 +13623,14 @@ selector: "includesKey:", protocol: 'testing', fn: function (aKey){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.hasOwnProperty(aKey); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "includesKey: aKey\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.HashedCollection); @@ -18287,20 +13641,14 @@ selector: "keys", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Object.keys(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "keys\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.HashedCollection); @@ -18311,20 +13659,14 @@ selector: "keysDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._keys())._do_(aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysDo: aBlock\x0a\x09self keys do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "keys"] }), $globals.HashedCollection); @@ -18335,38 +13677,24 @@ selector: "removeKey:ifAbsent:", protocol: 'adding/removing', fn: function (aKey,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._basicDelete_(aKey); return removed; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey", "aBlock"], source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"] }), $globals.HashedCollection); @@ -18377,24 +13705,18 @@ selector: "values", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self._keys().map(function(key){ return self._at_(key); }); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.HashedCollection); @@ -18405,20 +13727,14 @@ selector: "valuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._values())._do_(aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "valuesDo: aBlock\x0a\x09self values do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "values"] }), $globals.HashedCollection); @@ -18426,72 +13742,48 @@ $globals.HashedCollection); $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: 'comparing', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$4,$1,$5; var $early={}; try { $3=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__eq($recv(aCollection)._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["size"]=1; -//>>excludeEnd("ctx"); return $recv($4).__eq($recv(aCollection)._size()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["="]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); if(!$core.assert($1)){ return false; }; self._withIndexDo_((function(each,i){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $5=$recv($recv(aCollection)._at_(i)).__eq(each); if(!$core.assert($5)){ throw $early=[false]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)}); -//>>excludeEnd("ctx"); })); return true; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"] }), $globals.SequenceableCollection); @@ -18502,20 +13794,14 @@ selector: "addLast:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._add_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "addLast: anObject\x0a\x09self add: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:"] }), $globals.SequenceableCollection); @@ -18526,21 +13812,15 @@ selector: "allButFirst", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._copyFrom_to_((2),self._size()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copyFrom:to:", "size"] }), $globals.SequenceableCollection); @@ -18551,21 +13831,15 @@ selector: "allButLast", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1))); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copyFrom:to:", "-", "size"] }), $globals.SequenceableCollection); @@ -18576,21 +13850,15 @@ selector: "atRandom", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_($recv(self._size())._atRandom()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "atRandom\x0a\x09^ self at: self size atRandom", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:", "atRandom", "size"] }), $globals.SequenceableCollection); @@ -18601,33 +13869,23 @@ selector: "beginsWith:", protocol: 'testing', fn: function (prefix){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1,$4; $2=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $3=$recv(prefix)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=2; -//>>excludeEnd("ctx"); $1=$recv($2).__lt($3); if($core.assert($1)){ return false; }; $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix); return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["prefix"], source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "<", "size", "=", "first:"] }), $globals.SequenceableCollection); @@ -18639,32 +13897,22 @@ protocol: 'copying', fn: function (anIndex,anotherIndex){ var self=this; var range,newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; range=$recv(anIndex)._to_(anotherIndex); newCollection=$recv(self._class())._new_($recv(range)._size()); $recv(range)._withIndexDo_((function(each,i){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newCollection)._at_put_(i,self._at_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=newCollection; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "anotherIndex"], source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"] }), $globals.SequenceableCollection); @@ -18676,31 +13924,21 @@ protocol: 'copying', fn: function (){ var self=this; var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; newCollection=$recv(self._class())._new_(self._size()); self._withIndexDo_((function(each,index){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newCollection)._at_put_(index,$recv(each)._deepCopy()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=newCollection; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"] }), $globals.SequenceableCollection); @@ -18711,9 +13949,7 @@ selector: "detect:ifNone:", protocol: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); for(var i = 0; i < self.length; i++) @@ -18722,15 +13958,11 @@ return $core.withContext(function($ctx1) { return anotherBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -18741,9 +13973,7 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); for(var i=0; i < self.length; i++) { @@ -18751,15 +13981,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -18770,33 +13996,23 @@ selector: "endsWith:", protocol: 'testing', fn: function (suffix){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1,$4; $2=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $3=$recv(suffix)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=2; -//>>excludeEnd("ctx"); $1=$recv($2).__lt($3); if($core.assert($1)){ return false; }; $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix); return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["suffix"], source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "<", "size", "=", "last:"] }), $globals.SequenceableCollection); @@ -18807,21 +14023,15 @@ selector: "first", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_((1)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "first\x0a\x09^ self at: 1", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:"] }), $globals.SequenceableCollection); @@ -18832,9 +14042,7 @@ selector: "first:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv(self._size()).__lt(aNumber); if($core.assert($1)){ @@ -18842,15 +14050,11 @@ self._error_("Invalid number of elements"); }; $2=self._copyFrom_to_((1),aNumber); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"] }), $globals.SequenceableCollection); @@ -18861,21 +14065,15 @@ selector: "fourth", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_((4)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fourth\x0a\x09^ self at: 4", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:"] }), $globals.SequenceableCollection); @@ -18886,24 +14084,18 @@ selector: "includes:", protocol: 'testing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){ return nil; })))._notNil(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["notNil", "indexOf:ifAbsent:"] }), $globals.SequenceableCollection); @@ -18914,9 +14106,7 @@ selector: "indexOf:ifAbsent:", protocol: 'accessing', fn: function (anObject,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); for(var i=0; i < self.length; i++) { @@ -18925,15 +14115,11 @@ return $core.withContext(function($ctx1) { return aBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -18944,24 +14130,18 @@ selector: "indexOf:startingAt:", protocol: 'accessing', fn: function (anObject,start){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){ return (0); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "start"], source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["indexOf:startingAt:ifAbsent:"] }), $globals.SequenceableCollection); @@ -18972,9 +14152,7 @@ selector: "indexOf:startingAt:ifAbsent:", protocol: 'accessing', fn: function (anObject,start,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); for(var i=start - 1; i < self.length; i++){ @@ -18983,15 +14161,11 @@ return $core.withContext(function($ctx1) { return aBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "start", "aBlock"], source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -19002,21 +14176,15 @@ selector: "last", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_(self._size()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "last\x0a\x09^ self at: self size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:", "size"] }), $globals.SequenceableCollection); @@ -19027,35 +14195,25 @@ selector: "last:", protocol: 'accessing', fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$6,$5,$4,$3; $2=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__lt(aNumber); if($core.assert($1)){ self._error_("Invalid number of elements"); }; $6=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=2; -//>>excludeEnd("ctx"); $5=$recv($6).__minus(aNumber); $4=$recv($5).__plus((1)); $3=self._copyFrom_to_($4,self._size()); return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"] }), $globals.SequenceableCollection); @@ -19066,21 +14224,15 @@ selector: "newStream", protocol: 'streaming', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._streamClass())._on_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "newStream\x0a\x09^ self streamClass on: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["on:", "streamClass"] }), $globals.SequenceableCollection); @@ -19091,20 +14243,14 @@ selector: "numericallyIndexable", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.SequenceableCollection); @@ -19115,21 +14261,15 @@ selector: "readStream", protocol: 'streaming', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._stream(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["stream"] }), $globals.SequenceableCollection); @@ -19140,21 +14280,15 @@ selector: "removeLast", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._remove_(self._last()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeLast\x0a\x09^ self remove: self last", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["remove:", "last"] }), $globals.SequenceableCollection); @@ -19165,20 +14299,14 @@ selector: "reversed", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "reversed\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.SequenceableCollection); @@ -19189,21 +14317,15 @@ selector: "second", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_((2)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "second\x0a\x09^ self at: 2", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:"] }), $globals.SequenceableCollection); @@ -19215,31 +14337,21 @@ protocol: 'copying', fn: function (){ var self=this; var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; newCollection=$recv(self._class())._new_(self._size()); self._withIndexDo_((function(each,index){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newCollection)._at_put_(index,each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=newCollection; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"] }), $globals.SequenceableCollection); @@ -19250,21 +14362,15 @@ selector: "stream", protocol: 'streaming', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._newStream(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "stream\x0a\x09^ self newStream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["newStream"] }), $globals.SequenceableCollection); @@ -19275,21 +14381,15 @@ selector: "streamClass", protocol: 'streaming', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._streamClass(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "streamClass\x0a\x09^ self class streamClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["streamClass", "class"] }), $globals.SequenceableCollection); @@ -19300,21 +14400,15 @@ selector: "third", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._at_((3)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "third\x0a\x09^ self at: 3", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:"] }), $globals.SequenceableCollection); @@ -19325,9 +14419,7 @@ selector: "with:do:", protocol: 'enumerating', fn: function (anotherCollection,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); anotherCollection = anotherCollection._numericallyIndexable(); @@ -19336,15 +14428,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anotherCollection", "aBlock"], source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -19355,9 +14443,7 @@ selector: "withIndexDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self = self._numericallyIndexable(); for(var i=0; i < self.length; i++) { @@ -19365,15 +14451,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection); @@ -19384,21 +14466,15 @@ selector: "writeStream", protocol: 'streaming', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._stream(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["stream"] }), $globals.SequenceableCollection); @@ -19414,11 +14490,9 @@ function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Strea return $Stream(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "streamClass\x0a\x09\x09^ Stream", referencedClasses: ["Stream"], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SequenceableCollection.klass); @@ -19430,52 +14504,38 @@ protocol: 'streaming', fn: function (aBlock){ var self=this; var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; stream=$recv(self._streamClass())._on_(self._new()); $recv(aBlock)._value_(stream); $1=$recv(stream)._contents(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["on:", "streamClass", "new", "value:", "contents"] }), $globals.SequenceableCollection.klass); $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "add:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.push(anObject); return anObject;; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "add: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19486,20 +14546,14 @@ selector: "addFirst:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.unshift(anObject); return anObject;; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "addFirst: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19510,32 +14564,20 @@ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv("[".__comma($recv(self._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._join_(", "))).__comma("]"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "join:", "collect:", "asJavascript"] }), $globals.Array); @@ -19546,24 +14588,18 @@ selector: "at:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return anIndex >= 1 && anIndex <= self.length ? self[anIndex - 1] : aBlock._value() ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19574,24 +14610,18 @@ selector: "at:ifPresent:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return anIndex >= 1 && anIndex <= self.length ? aBlock._value_(self[anIndex - 1]) : anotherBlock._value() ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock", "anotherBlock"], source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19602,20 +14632,14 @@ selector: "at:put:", protocol: 'accessing', fn: function (anIndex,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self[anIndex - 1] = anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19626,20 +14650,14 @@ selector: "collect:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.map(function(each) {return aBlock._value_(each)}); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19650,20 +14668,14 @@ selector: "join:", protocol: 'enumerating', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.join(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "join: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19677,11 +14689,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "numericallyIndexable\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19692,55 +14702,31 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["printOn:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(" ("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); self._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._printOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aStream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"] }), $globals.Array); @@ -19752,9 +14738,7 @@ protocol: 'adding/removing', fn: function (anObject,aBlock){ var self=this; var index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; index=self._indexOf_ifAbsent_(anObject,(function(){ return (0); @@ -19768,15 +14752,11 @@ self._removeIndex_(index); $1=anObject; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"] }), $globals.Array); @@ -19787,20 +14767,14 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.length = 0; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19811,20 +14785,14 @@ selector: "removeFrom:to:", protocol: 'adding/removing', fn: function (aNumber,anotherNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.splice(aNumber -1, anotherNumber - aNumber + 1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber", "anotherNumber"], source: "removeFrom: aNumber to: anotherNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19835,20 +14803,14 @@ selector: "removeIndex:", protocol: 'adding/removing', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.splice(anInteger - 1, 1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "removeIndex: anInteger\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19859,20 +14821,14 @@ selector: "removeLast", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.pop();; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeLast\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19883,20 +14839,14 @@ selector: "reversed", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self._copy().reverse(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "reversed\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19907,9 +14857,7 @@ selector: "select:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var result = self.klass._new(); for(var i=0; i>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19939,20 +14883,14 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.length; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -19963,29 +14901,19 @@ selector: "sort", protocol: 'enumerating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._sort_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(a).__lt(b); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sort:", "<"] }), $globals.Array); @@ -19996,24 +14924,18 @@ selector: "sort:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.sort(function(a, b) { if(aBlock._value_value_(a,b)) {return -1} else {return 1} }) ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array); @@ -20024,21 +14946,15 @@ selector: "sorted", protocol: 'enumerating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._copy())._sort(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sorted\x0a\x09^ self copy sort", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sort", "copy"] }), $globals.Array); @@ -20049,21 +14965,15 @@ selector: "sorted:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._copy())._sort_(aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sort:", "copy"] }), $globals.Array); @@ -20075,20 +14985,14 @@ selector: "new:", protocol: 'instance creation', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return new Array(anInteger); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "new: anInteger\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Array.klass); @@ -20099,24 +15003,18 @@ selector: "with:", protocol: 'instance creation', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new_((1)); $recv($2)._at_put_((1),anObject); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:put:", "new:", "yourself"] }), $globals.Array.klass); @@ -20127,28 +15025,20 @@ selector: "with:with:", protocol: 'instance creation', fn: function (anObject,anObject2){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new_((2)); $recv($2)._at_put_((1),anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); $recv($2)._at_put_((2),anObject2); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anObject2"], source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:put:", "new:", "yourself"] }), $globals.Array.klass); @@ -20159,32 +15049,22 @@ selector: "with:with:with:", protocol: 'instance creation', fn: function (anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new_((3)); $recv($2)._at_put_((1),anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); $recv($2)._at_put_((2),anObject2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); $recv($2)._at_put_((3),anObject3); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anObject2", "anObject3"], source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:put:", "new:", "yourself"] }), $globals.Array.klass); @@ -20196,68 +15076,48 @@ protocol: 'instance creation', fn: function (aCollection){ var self=this; var instance,index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; index=(1); instance=self._new_($recv(aCollection)._size()); $recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(instance)._at_put_(index,each); index=$recv(index).__plus((1)); return index; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=instance; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new:", "size", "do:", "at:put:", "+"] }), $globals.Array.klass); $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.CharacterArray.comment="I am the abstract superclass of string-like collections."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: ",", protocol: 'copying', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["asString"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__comma($recv(aString)._asString()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: ", aString\x0a\x09^ self asString, aString asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "asString"] }), $globals.CharacterArray); @@ -20268,20 +15128,14 @@ selector: "add:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._errorReadOnly(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "add: anObject\x0a\x09self errorReadOnly", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["errorReadOnly"] }), $globals.CharacterArray); @@ -20292,21 +15146,15 @@ selector: "asLowercase", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fromString:", "class", "asLowercase", "asString"] }), $globals.CharacterArray); @@ -20317,21 +15165,15 @@ selector: "asNumber", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._asString())._asNumber(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asNumber\x0a\x09^ self asString asNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asNumber", "asString"] }), $globals.CharacterArray); @@ -20342,21 +15184,15 @@ selector: "asString", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._subclassResponsibility(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09^ self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.CharacterArray); @@ -20367,21 +15203,15 @@ selector: "asSymbol", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._asString(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asSymbol\x0a\x09^ self asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asString"] }), $globals.CharacterArray); @@ -20392,21 +15222,15 @@ selector: "asUppercase", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fromString:", "class", "asUppercase", "asString"] }), $globals.CharacterArray); @@ -20417,20 +15241,14 @@ selector: "at:put:", protocol: 'accessing', fn: function (anIndex,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._errorReadOnly(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09self errorReadOnly", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["errorReadOnly"] }), $globals.CharacterArray); @@ -20441,20 +15259,14 @@ selector: "errorReadOnly", protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._error_("Object is read-only"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "errorReadOnly\x0a\x09self error: 'Object is read-only'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["error:"] }), $globals.CharacterArray); @@ -20465,20 +15277,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._asString())._printOn_(aStream); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09self asString printOn: aStream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "asString"] }), $globals.CharacterArray); @@ -20489,20 +15295,14 @@ selector: "putOn:", protocol: 'streaming', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutString_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "putOn: aStream\x0a\x09aStream nextPutString: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutString:"] }), $globals.CharacterArray); @@ -20513,20 +15313,14 @@ selector: "remove:", protocol: 'adding/removing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._errorReadOnly(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "remove: anObject\x0a\x09self errorReadOnly", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["errorReadOnly"] }), $globals.CharacterArray); @@ -20538,49 +15332,35 @@ selector: "fromString:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "fromString: aString\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.CharacterArray.klass); $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: ",", protocol: 'copying', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) + aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: ", aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20591,20 +15371,14 @@ selector: "<", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) < aString._asString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "< aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20615,20 +15389,14 @@ selector: "<=", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) <= aString._asString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "<= aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20639,26 +15407,16 @@ selector: "=", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); - - return aString != null && - typeof aString._isString === "function" && - aString._isString() && - String(self) === String(aString) - ; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$1=self.__eq_eq(aString); +return $1; }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>", +source: "= aString\x0a\x09^ self == aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["=="] }), $globals.String); @@ -20668,22 +15426,15 @@ selector: "==", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self.__eq(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf()); +return self; }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "== aString\x0a\x09^ self = aString", +source: "== aString\x0a", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["="] +messageSends: [] }), $globals.String); @@ -20693,20 +15444,14 @@ selector: ">", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) > aString._asString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "> aString\x0a\x09> aString._asString()>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20717,20 +15462,14 @@ selector: ">=", protocol: 'comparing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self) >= aString._asString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: ">= aString\x0a\x09>= aString._asString()>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20744,11 +15483,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJSON\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20759,20 +15496,14 @@ selector: "asJavaScriptMethodName", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.st2js(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavaScriptMethodName\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20783,9 +15514,7 @@ selector: "asJavascript", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1) return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\""; @@ -20793,15 +15522,11 @@ return $core.withContext(function($ctx1) { return "\"" + self + "\""; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20812,20 +15537,14 @@ selector: "asLowercase", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toLowerCase(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asLowercase\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20836,9 +15555,7 @@ selector: "asMutator", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv(self._last()).__eq(":"); if(!$core.assert($1)){ @@ -20846,15 +15563,11 @@ $2=self.__comma(":"); return $2; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "=", "last", ","] }), $globals.String); @@ -20865,20 +15578,14 @@ selector: "asNumber", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Number(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asNumber\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20890,21 +15597,15 @@ protocol: 'converting', fn: function (){ var self=this; function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($RegularExpression())._fromString_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asRegexp\x0a\x09^ RegularExpression fromString: self", referencedClasses: ["RegularExpression"], -//>>excludeEnd("ide"); messageSends: ["fromString:"] }), $globals.String); @@ -20918,11 +15619,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asString\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20936,11 +15635,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asSymbol\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20951,20 +15648,14 @@ selector: "asUppercase", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.toUpperCase(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asUppercase\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20975,20 +15666,14 @@ selector: "asciiValue", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.charCodeAt(0);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asciiValue\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -20999,20 +15684,14 @@ selector: "at:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self)[anIndex - 1] || aBlock._value(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21023,23 +15702,17 @@ selector: "at:ifPresent:ifAbsent:", protocol: 'accessing', fn: function (anIndex,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var result = String(self)[anIndex - 1]; return result ? aBlock._value_(result) : anotherBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "aBlock", "anotherBlock"], source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21050,9 +15723,7 @@ selector: "capitalized", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._isEmpty(); if($core.assert($2)){ @@ -21061,15 +15732,11 @@ $1=self; $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst()); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"] }), $globals.String); @@ -21080,20 +15747,14 @@ selector: "charCodeAt:", protocol: 'accessing', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.charCodeAt(anInteger - 1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "charCodeAt: anInteger\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21104,20 +15765,14 @@ selector: "copyFrom:to:", protocol: 'copying', fn: function (anIndex,anotherIndex){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.substring(anIndex - 1, anotherIndex); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex", "anotherIndex"], source: "copyFrom: anIndex to: anotherIndex\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21129,21 +15784,15 @@ protocol: 'converting', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._lines())._join_($recv($String())._lf()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "crlfSanitized\x0a\x09^ self lines join: String lf", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["join:", "lines", "lf"] }), $globals.String); @@ -21154,21 +15803,15 @@ selector: "deepCopy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._shallowCopy(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "deepCopy\x0a\x09^ self shallowCopy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["shallowCopy"] }), $globals.String); @@ -21179,69 +15822,32 @@ selector: "escaped", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return escape(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "escaped\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); -$core.addMethod( -$core.method({ -selector: "identityHash", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self.__comma("s"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.String)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "identityHash\x0a\x09^ self, 's'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [","] -}), -$globals.String); - $core.addMethod( $core.method({ selector: "includesSubString:", protocol: 'testing', fn: function (subString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.indexOf(subString) != -1; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["subString"], source: "includesSubString: subString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21252,26 +15858,18 @@ selector: "isCapitalized", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $3=self._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._asUppercase(); $1=$recv($2).__eq_eq(self._first()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isCapitalized\x0a\x09^ self first asUppercase == self first", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["==", "asUppercase", "first"] }), $globals.String); @@ -21285,11 +15883,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21303,11 +15899,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isString\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21318,29 +15912,19 @@ selector: "isVowel", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv(self._size()).__eq((1)))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return "aeiou"._includes_(self._asLowercase()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["and:", "=", "size", "includes:", "asLowercase"] }), $globals.String); @@ -21352,48 +15936,28 @@ protocol: 'split join', fn: function (aCollection){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aCollection)._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_($recv(each)._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"] }), $globals.String); @@ -21406,9 +15970,7 @@ fn: function (aBlock){ var self=this; var cr,lf,start,sz,nextLF,nextCR; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11; var $early={}; try { @@ -21416,127 +15978,73 @@ start=(1); sz=self._size(); cr=$recv($String())._cr(); nextCR=self._indexOf_startingAt_(cr,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["indexOf:startingAt:"]=1; -//>>excludeEnd("ctx"); lf=$recv($String())._lf(); nextLF=self._indexOf_startingAt_(lf,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["indexOf:startingAt:"]=2; -//>>excludeEnd("ctx"); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(start).__lt_eq(sz); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(nextLF).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(nextCR).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["="]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); if($core.assert($1)){ $recv(aBlock)._value_value_value_(start,sz,sz); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:value:value:"]=1; -//>>excludeEnd("ctx"); throw $early=[self]; }; $4=$recv(nextCR).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["="]=3; -//>>excludeEnd("ctx"); $3=$recv($4)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); $5=(0).__lt(nextLF); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["<"]=1; -//>>excludeEnd("ctx"); return $recv($5)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); return $recv(nextLF).__lt(nextCR); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)}); -//>>excludeEnd("ctx"); })); if($core.assert($3)){ $6=start; $7=$recv(nextLF).__minus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["-"]=1; -//>>excludeEnd("ctx"); $recv(aBlock)._value_value_value_($6,$7,nextLF); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:value:value:"]=2; -//>>excludeEnd("ctx"); start=(1).__plus(nextLF); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); start; nextLF=self._indexOf_startingAt_(lf,start); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["indexOf:startingAt:"]=3; -//>>excludeEnd("ctx"); return nextLF; } else { $9=(1).__plus(nextCR); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=2; -//>>excludeEnd("ctx"); $8=$recv($9).__eq(nextLF); if($core.assert($8)){ $10=start; $11=$recv(nextCR).__minus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["-"]=2; -//>>excludeEnd("ctx"); $recv(aBlock)._value_value_value_($10,$11,nextLF); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:value:value:"]=3; -//>>excludeEnd("ctx"); start=(1).__plus(nextLF); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=3; -//>>excludeEnd("ctx"); start; nextCR=self._indexOf_startingAt_(cr,start); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["indexOf:startingAt:"]=4; -//>>excludeEnd("ctx"); nextCR; nextLF=self._indexOf_startingAt_(lf,start); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["indexOf:startingAt:"]=5; -//>>excludeEnd("ctx"); return nextLF; } else { $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR); @@ -21546,22 +16054,16 @@ nextCR=self._indexOf_startingAt_(cr,start); return nextCR; }; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"] }), $globals.String); @@ -21573,17 +16075,13 @@ protocol: 'split join', fn: function (anIndex){ var self=this; var lineCount; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3; var $early={}; try { lineCount=(0); self._lineIndicesDo_((function(start,endWithoutDelimiters,end){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); lineCount=$recv(lineCount).__plus((1)); $2=lineCount; $1=$recv($2).__eq(anIndex); @@ -21591,22 +16089,16 @@ if($core.assert($1)){ $3=self._copyFrom_to_(start,endWithoutDelimiters); throw $early=[$3]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return nil; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIndex"], source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"] }), $globals.String); @@ -21619,31 +16111,21 @@ fn: function (){ var self=this; var lines; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; lines=$recv($Array())._new(); self._linesDo_((function(aLine){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(lines)._add_(aLine); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=lines; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["new", "linesDo:", "add:"] }), $globals.String); @@ -21654,28 +16136,18 @@ selector: "linesDo:", protocol: 'split join', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._lineIndicesDo_((function(start,endWithoutDelimiters,end){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"] }), $globals.String); @@ -21686,20 +16158,14 @@ selector: "match:", protocol: 'regular expressions', fn: function (aRegexp){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.search(aRegexp) != -1; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRegexp"], source: "match: aRegexp\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21710,20 +16176,14 @@ selector: "matchesOf:", protocol: 'regular expressions', fn: function (aRegularExpression){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.match(aRegularExpression); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRegularExpression"], source: "matchesOf: aRegularExpression\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21734,20 +16194,14 @@ selector: "numericallyIndexable", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "numericallyIndexable\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21758,20 +16212,14 @@ selector: "printNl", protocol: 'printing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); console.log(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printNl\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21782,29 +16230,19 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aStream)._nextPutAll_("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_("'"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:"] }), $globals.String); @@ -21816,21 +16254,15 @@ protocol: 'regular expressions', fn: function (aString,anotherString){ var self=this; function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString"], source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString", referencedClasses: ["RegularExpression"], -//>>excludeEnd("ide"); messageSends: ["replaceRegexp:with:", "fromString:flag:"] }), $globals.String); @@ -21841,20 +16273,14 @@ selector: "replaceRegexp:with:", protocol: 'regular expressions', fn: function (aRegexp,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.replace(aRegexp, aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRegexp", "aString"], source: "replaceRegexp: aRegexp with: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21865,20 +16291,14 @@ selector: "reversed", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.split("").reverse().join(""); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "reversed\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21889,21 +16309,15 @@ selector: "shallowCopy", protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._fromString_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "shallowCopy\x0a\x09^ self class fromString: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fromString:", "class"] }), $globals.String); @@ -21914,20 +16328,14 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.length; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21938,21 +16346,15 @@ selector: "subStrings:", protocol: 'split join', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._tokenize_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "subStrings: aString\x0a\x09^ self tokenize: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["tokenize:"] }), $globals.String); @@ -21963,20 +16365,14 @@ selector: "tokenize:", protocol: 'split join', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.split(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "tokenize: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -21987,21 +16383,15 @@ selector: "trimBoth", protocol: 'regular expressions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._trimBoth_("\x5cs"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["trimBoth:"] }), $globals.String); @@ -22012,21 +16402,15 @@ selector: "trimBoth:", protocol: 'regular expressions', fn: function (separators){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._trimLeft_(separators))._trimRight_(separators); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["separators"], source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["trimRight:", "trimLeft:"] }), $globals.String); @@ -22037,21 +16421,15 @@ selector: "trimLeft", protocol: 'regular expressions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._trimLeft_("\x5cs"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["trimLeft:"] }), $globals.String); @@ -22063,26 +16441,18 @@ protocol: 'regular expressions', fn: function (separators){ var self=this; function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $3=$recv("^[".__comma(separators)).__comma("]+"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $2=$recv($RegularExpression())._fromString_flag_($3,"g"); $1=self._replaceRegexp_with_($2,""); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["separators"], source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''", referencedClasses: ["RegularExpression"], -//>>excludeEnd("ide"); messageSends: ["replaceRegexp:with:", "fromString:flag:", ","] }), $globals.String); @@ -22093,21 +16463,15 @@ selector: "trimRight", protocol: 'regular expressions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._trimRight_("\x5cs"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "trimRight\x0a\x09^ self trimRight: '\x5cs'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["trimRight:"] }), $globals.String); @@ -22119,26 +16483,18 @@ protocol: 'regular expressions', fn: function (separators){ var self=this; function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $3=$recv("[".__comma(separators)).__comma("]+$"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $2=$recv($RegularExpression())._fromString_flag_($3,"g"); $1=self._replaceRegexp_with_($2,""); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["separators"], source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''", referencedClasses: ["RegularExpression"], -//>>excludeEnd("ide"); messageSends: ["replaceRegexp:with:", "fromString:flag:", ","] }), $globals.String); @@ -22149,20 +16505,14 @@ selector: "unescaped", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return unescape(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "unescaped\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -22173,20 +16523,14 @@ selector: "uriComponentDecoded", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return decodeURIComponent(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "uriComponentDecoded\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -22197,20 +16541,14 @@ selector: "uriComponentEncoded", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return encodeURIComponent(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "uriComponentEncoded\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -22221,20 +16559,14 @@ selector: "uriDecoded", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return decodeURI(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "uriDecoded\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -22245,20 +16577,14 @@ selector: "uriEncoded", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return encodeURI(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "uriEncoded\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -22269,21 +16595,15 @@ selector: "value:", protocol: 'evaluating', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(anObject)._perform_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "value: anObject \x0a\x09^ anObject perform: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["perform:"] }), $globals.String); @@ -22295,20 +16615,14 @@ selector: "cr", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return '\r'; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "cr\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22319,20 +16633,14 @@ selector: "crlf", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return '\r\n'; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "crlf\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22343,21 +16651,15 @@ selector: "esc", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._fromCharCode_((27)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "esc\x0a\x09^ self fromCharCode: 27", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fromCharCode:"] }), $globals.String.klass); @@ -22368,20 +16670,14 @@ selector: "fromCharCode:", protocol: 'instance creation', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String.fromCharCode(anInteger); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "fromCharCode: anInteger\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22392,20 +16688,14 @@ selector: "fromString:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "fromString: aString\x0a\x09\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22416,20 +16706,14 @@ selector: "lf", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return '\n'; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "lf\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22440,20 +16724,14 @@ selector: "random", protocol: 'random', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22465,32 +16743,22 @@ protocol: 'random', fn: function (aString){ var self=this; var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); result=self._random(); result; return $recv(aString)._includesSubString_(result); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileTrue(); $1=result; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileTrue", "random", "includesSubString:"] }), $globals.String.klass); @@ -22501,20 +16769,14 @@ selector: "space", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return ' '; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "space\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22529,11 +16791,9 @@ function $StringStream(){return $globals.StringStream||(typeof StringStream=="un return $StringStream(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "streamClass\x0a\x09\x09^ StringStream", referencedClasses: ["StringStream"], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22544,20 +16804,14 @@ selector: "tab", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return '\t'; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "tab\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); @@ -22568,84 +16822,60 @@ selector: "value:", protocol: 'instance creation', fn: function (aUTFCharCode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return String.fromCharCode(aUTFCharCode);; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aUTFCharCode"], source: "value: aUTFCharCode\x0a\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String.klass); $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: 'comparing', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$4,$3,$5; var $early={}; try { $2=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__eq($recv(aCollection)._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); if(!$core.assert($1)){ return false; }; $4=self._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__eq($recv(aCollection)._size()); if(!$core.assert($3)){ return false; }; self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $5=$recv(aCollection)._includes_(each); if(!$core.assert($5)){ throw $early=[false]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); })); return true; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"] }), $globals.Set); @@ -22657,31 +16887,23 @@ protocol: 'adding/removing', fn: function (anObject){ var self=this; var bucket; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; bucket=self._bucketsOfElement_(anObject); $2=$recv(bucket)._second(); if(($receiver = $2) == null || $receiver.isNil){ var object,slowBucket; object=$recv(bucket)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); object; slowBucket=$recv(bucket)._third(); slowBucket; $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(slowBucket)._add_(object); self["@size"]=$recv(self["@size"]).__plus((1)); return self["@size"]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $1=object; } else { @@ -22690,15 +16912,11 @@ primitiveBucket=$receiver; $1=self._add_in_($recv(bucket)._first(),primitiveBucket); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"] }), $globals.Set); @@ -22709,24 +16927,18 @@ selector: "add:in:", protocol: 'private', fn: function (anObject,anotherObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if (anObject in anotherObject.store) { return false; } self['@size']++; return anotherObject.store[anObject] = true; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anotherObject"], source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -22737,9 +16949,7 @@ selector: "bucketsOfElement:", protocol: 'private', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf(); if ((type = typeof prim) === "object") { @@ -22758,15 +16968,11 @@ return $core.withContext(function($ctx1) { return [ prim, self['@fastBuckets'][type] ]; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -22777,20 +16983,14 @@ selector: "classNameOf:", protocol: 'private', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return anObject.klass && anObject.klass.className; +return anObject.klass != null && anObject.klass.className; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], -source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09", +source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -22802,31 +17002,21 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; collection=$recv(self._class())._new(); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(collection)._add_($recv(aBlock)._value_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $1=collection; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "do:", "add:", "value:"] }), $globals.Set); @@ -22837,37 +17027,27 @@ selector: "detect:ifNone:", protocol: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; var $early={}; try { self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(each); if($core.assert($1)){ throw $early=[each]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=$recv(anotherBlock)._value(); return $2; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifTrue:", "value:", "value"] }), $globals.Set); @@ -22878,9 +17058,7 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var el, keys, i; el = self['@fastBuckets']; @@ -22895,15 +17073,11 @@ return $core.withContext(function($ctx1) { self['@defaultBucket']._do_(aBlock); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -22915,18 +17089,14 @@ protocol: 'testing', fn: function (anObject){ var self=this; var bucket; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$4,$1,$receiver; bucket=self._bucketsOfElement_(anObject); $2=$recv(bucket)._second(); if(($receiver = $2) == null || $receiver.isNil){ $3=$recv(bucket)._third(); $4=$recv(bucket)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); $1=$recv($3)._includes_($4); } else { var primitiveBucket; @@ -22934,15 +17104,11 @@ primitiveBucket=$receiver; $1=self._includes_in_($recv(bucket)._first(),primitiveBucket); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"] }), $globals.Set); @@ -22953,20 +17119,14 @@ selector: "includes:in:", protocol: 'private', fn: function (anObject,anotherObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return anObject in anotherObject.store; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anotherObject"], source: "includes: anObject in: anotherObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -22977,31 +17137,21 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@defaultBucket"]=[]; self._initializeSlowBucketStores(); $1=self._removeAll(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"] }), $globals.Set); @@ -23013,41 +17163,25 @@ protocol: 'initialization', fn: function (){ var self=this; function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($ArrayBucketStore())._hashBlock_((function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._classNameOf_(x); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["hashBlock:"]=1; -//>>excludeEnd("ctx"); self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._jsConstructorNameOf_(x); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)}); -//>>excludeEnd("ctx"); }))]; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}", referencedClasses: ["ArrayBucketStore"], -//>>excludeEnd("ide"); messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"] }), $globals.Set); @@ -23058,20 +17192,14 @@ selector: "jsConstructorNameOf:", protocol: 'private', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return anObject.constructor && anObject.constructor.name; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "jsConstructorNameOf: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -23082,55 +17210,31 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["printOn:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(" ("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); self._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._printOn_(aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aStream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"] }), $globals.Set); @@ -23142,9 +17246,7 @@ protocol: 'adding/removing', fn: function (anObject,aBlock){ var self=this; var bucket; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$4,$5,$1,$receiver; var $early={}; try { @@ -23153,18 +17255,12 @@ $2=$recv(bucket)._second(); if(($receiver = $2) == null || $receiver.isNil){ $3=$recv(bucket)._third(); $4=$recv(bucket)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); $recv($3)._remove_ifAbsent_($4,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $5=$recv(aBlock)._value(); throw $early=[$5]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); self["@size"]=$recv(self["@size"]).__minus((1)); $1=self["@size"]; @@ -23176,15 +17272,11 @@ $1=self._remove_in_($recv(bucket)._first(),primitiveBucket); return $1; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "aBlock"], source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"] }), $globals.Set); @@ -23195,20 +17287,14 @@ selector: "remove:in:", protocol: 'private', fn: function (anObject,anotherObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); if (delete anotherObject.store[anObject]) self['@size']--; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject", "anotherObject"], source: "remove: anObject in: anotherObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -23219,9 +17305,7 @@ selector: "removeAll", protocol: 'adding/removing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self['@fastBuckets'] = { 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } }, @@ -23233,15 +17317,11 @@ return $core.withContext(function($ctx1) { self['@size'] = 0; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); @@ -23253,34 +17333,24 @@ protocol: 'enumerating', fn: function (aBlock){ var self=this; var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; collection=$recv(self._class())._new(); self._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(aBlock)._value_(each); if($core.assert($1)){ return $recv(collection)._add_(each); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=collection; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"] }), $globals.Set); @@ -23296,332 +17366,34 @@ $1=self["@size"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09^ size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Set); -$core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "initialize", -protocol: 'initialization', -fn: function (){ -var self=this; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@read"]=$recv($OrderedCollection())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -self["@write"]=$recv($OrderedCollection())._new(); -self["@readIndex"]=(1); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "new"] -}), -$globals.Queue); - -$core.addMethod( -$core.method({ -selector: "next", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._nextIfAbsent_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._error_("Cannot read from empty Queue."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextIfAbsent:", "error:"] -}), -$globals.Queue); - -$core.addMethod( -$core.method({ -selector: "nextIfAbsent:", -protocol: 'accessing', -fn: function (aBlock){ -var self=this; -var result; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -var $early={}; -try { -result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(self["@write"])._isEmpty(); -if($core.assert($1)){ -$2=$recv(self["@readIndex"]).__gt((1)); -if($core.assert($2)){ -self["@read"]=[]; -self["@read"]; -self["@readIndex"]=(1); -self["@readIndex"]; -}; -$3=$recv(aBlock)._value(); -throw $early=[$3]; -}; -self["@read"]=self["@write"]; -self["@read"]; -self["@readIndex"]=(1); -self["@readIndex"]; -self["@write"]=$recv($OrderedCollection())._new(); -self["@write"]; -return $recv(self["@read"])._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv(self["@read"])._at_put_(self["@readIndex"],nil); -self["@readIndex"]=$recv(self["@readIndex"]).__plus((1)); -$4=result; -return $4; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"] -}), -$globals.Queue); - -$core.addMethod( -$core.method({ -selector: "nextPut:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@write"])._add_(anObject); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "nextPut: anObject\x0a\x09write add: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:"] -}), -$globals.Queue); - - - -$core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "compile:", -protocol: 'evaluating', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return self.compile(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "compile: aString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.RegularExpression); - -$core.addMethod( -$core.method({ -selector: "exec:", -protocol: 'evaluating', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return self.exec(aString) || nil; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "exec: aString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.RegularExpression); - -$core.addMethod( -$core.method({ -selector: "test:", -protocol: 'evaluating', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return self.test(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "test: aString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.RegularExpression); - - -$core.addMethod( -$core.method({ -selector: "fromString:", -protocol: 'instance creation', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._fromString_flag_(aString,""); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["fromString:flag:"] -}), -$globals.RegularExpression.klass); - -$core.addMethod( -$core.method({ -selector: "fromString:flag:", -protocol: 'instance creation', -fn: function (aString,anotherString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return new RegExp(aString, anotherString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anotherString"], -source: "fromString: aString flag: anotherString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.RegularExpression.klass); - - -$core.addClass('Stream', $globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection."; -//>>excludeEnd("ide"); +$core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections'); +$globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents."; $core.addMethod( $core.method({ selector: "<<", protocol: 'writing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._write_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.Stream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "<< anObject\x0a\x09self write: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["write:"] }), -$globals.Stream); +$globals.ProtoStream); $core.addMethod( $core.method({ @@ -23629,24 +17401,17 @@ selector: "atEnd", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._position()).__eq(self._size()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "atEnd\x0a\x09^ self position = self size", +source: "atEnd\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["=", "position", "size"] +messageSends: ["subclassResponsibility"] }), -$globals.Stream); +$globals.ProtoStream); $core.addMethod( $core.method({ @@ -23654,62 +17419,17 @@ selector: "atStart", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._position()).__eq((0)); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "atStart\x0a\x09^ self position = 0", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["=", "position"] -}), -$globals.Stream); - -$core.addMethod( -$core.method({ -selector: "close", -protocol: 'actions', -fn: function (){ -var self=this; +self._subclassResponsibility(); return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "close", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Stream); - -$core.addMethod( -$core.method({ -selector: "collection", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@collection"]; -return $1; - +}, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09^ collection", +source: "atStart\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.Stream); +$globals.ProtoStream); $core.addMethod( $core.method({ @@ -23717,24 +17437,17 @@ selector: "contents", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._collection())._copyFrom_to_((1),self._streamSize()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize", +source: "contents\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["copyFrom:to:", "collection", "streamSize"] +messageSends: ["subclassResponsibility"] }), -$globals.Stream); +$globals.ProtoStream); $core.addMethod( $core.method({ @@ -23742,38 +17455,379 @@ selector: "do:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aBlock)._value_(self._next()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Stream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["whileFalse:", "atEnd", "value:", "next"] }), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "isEmpty", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._atStart())._and_((function(){ +return $core.withContext(function($ctx2) { +return self._atEnd(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)}); +}, +args: [], +source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]", +referencedClasses: [], +messageSends: ["and:", "atStart", "atEnd"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "next", +protocol: 'reading', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._atEnd(); +if($core.assert($2)){ +$1=nil; +} else { +$1=self._subclassResponsibility(); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)}); +}, +args: [], +source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "nextPut:", +protocol: 'writing', +fn: function (anObject){ +var self=this; +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)}); +}, +args: ["anObject"], +source: "nextPut: anObject\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "nextPutAll:", +protocol: 'writing', +fn: function (aCollection){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aCollection)._do_((function(each){ +return $core.withContext(function($ctx2) { +return self._nextPut_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)}); +}, +args: ["aCollection"], +source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]", +referencedClasses: [], +messageSends: ["do:", "nextPut:"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "nextPutJSObject:", +protocol: 'writing', +fn: function (aJSObject){ +var self=this; +return $core.withContext(function($ctx1) { +self._nextPut_(aJSObject); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)}); +}, +args: ["aJSObject"], +source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject", +referencedClasses: [], +messageSends: ["nextPut:"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "nextPutString:", +protocol: 'writing', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +self._nextPut_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)}); +}, +args: ["aString"], +source: "nextPutString: aString\x0a\x09self nextPut: aString", +referencedClasses: [], +messageSends: ["nextPut:"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "peek", +protocol: 'reading', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._atEnd(); +if($core.assert($2)){ +$1=nil; +} else { +$1=self._subclassResponsibility(); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)}); +}, +args: [], +source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "reset", +protocol: 'actions', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)}); +}, +args: [], +source: "reset\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "resetContents", +protocol: 'actions', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)}); +}, +args: [], +source: "resetContents\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "setToEnd", +protocol: 'positioning', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)}); +}, +args: [], +source: "setToEnd\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "setToStart", +protocol: 'positioning', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._reset(); +return self; +}, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)}); +}, +args: [], +source: "setToStart\x0a\x09self reset", +referencedClasses: [], +messageSends: ["reset"] +}), +$globals.ProtoStream); + +$core.addMethod( +$core.method({ +selector: "write:", +protocol: 'writing', +fn: function (anObject){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(anObject)._putOn_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)}); +}, +args: ["anObject"], +source: "write: anObject\x0a\x09anObject putOn: self", +referencedClasses: [], +messageSends: ["putOn:"] +}), +$globals.ProtoStream); + + +$core.addMethod( +$core.method({ +selector: "on:", +protocol: 'instance creation', +fn: function (aCollection){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._new(); +$recv($2)._setCollection_(aCollection); +$recv($2)._setStreamSize_($recv(aCollection)._size()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)}); +}, +args: ["aCollection"], +source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself", +referencedClasses: [], +messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"] +}), +$globals.ProtoStream.klass); + + +$core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections'); +$globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection."; +$core.addMethod( +$core.method({ +selector: "atEnd", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._position()).__eq(self._size()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)}); +}, +args: [], +source: "atEnd\x0a\x09^ self position = self size", +referencedClasses: [], +messageSends: ["=", "position", "size"] +}), +$globals.Stream); + +$core.addMethod( +$core.method({ +selector: "atStart", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._position()).__eq((0)); +return $1; +}, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)}); +}, +args: [], +source: "atStart\x0a\x09^ self position = 0", +referencedClasses: [], +messageSends: ["=", "position"] +}), +$globals.Stream); + +$core.addMethod( +$core.method({ +selector: "close", +protocol: 'actions', +fn: function (){ +var self=this; +return self; + +}, +args: [], +source: "close", +referencedClasses: [], +messageSends: [] +}), +$globals.Stream); + +$core.addMethod( +$core.method({ +selector: "collection", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@collection"]; +return $1; + +}, +args: [], +source: "collection\x0a\x09^ collection", +referencedClasses: [], +messageSends: [] +}), +$globals.Stream); + +$core.addMethod( +$core.method({ +selector: "contents", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._collection())._copyFrom_to_((1),self._streamSize()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)}); +}, +args: [], +source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize", +referencedClasses: [], +messageSends: ["copyFrom:to:", "collection", "streamSize"] +}), $globals.Stream); $core.addMethod( @@ -23785,11 +17839,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "flush", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Stream); @@ -23800,21 +17852,15 @@ selector: "isEmpty", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._size()).__eq((0)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isEmpty\x0a\x09^ self size = 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["=", "size"] }), $globals.Stream); @@ -23825,32 +17871,24 @@ selector: "next", protocol: 'reading', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$4,$3,$1; $2=self._atEnd(); if($core.assert($2)){ $1=nil; } else { $4=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__plus((1)); self._position_($3); $1=$recv(self["@collection"])._at_(self._position()); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"] }), $globals.Stream); @@ -23862,34 +17900,24 @@ protocol: 'reading', fn: function (anInteger){ var self=this; var tempCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; tempCollection=$recv($recv(self._collection())._class())._new(); $recv(anInteger)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=self._atEnd(); if(!$core.assert($1)){ return $recv(tempCollection)._add_(self._next()); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=tempCollection; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"] }), $globals.Stream); @@ -23900,117 +17928,45 @@ selector: "nextPut:", protocol: 'writing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$4; $2=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__plus((1)); self._position_($1); $3=self._collection(); $4=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=2; -//>>excludeEnd("ctx"); $recv($3)._at_put_($4,anObject); self._setStreamSize_($recv(self._streamSize())._max_(self._position())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"] }), $globals.Stream); -$core.addMethod( -$core.method({ -selector: "nextPutAll:", -protocol: 'writing', -fn: function (aCollection){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._nextPut_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.Stream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "nextPut:"] -}), -$globals.Stream); - -$core.addMethod( -$core.method({ -selector: "nextPutString:", -protocol: 'writing', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._nextPut_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.Stream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "nextPutString: aString\x0a\x09self nextPut: aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPut:"] -}), -$globals.Stream); - $core.addMethod( $core.method({ selector: "peek", protocol: 'reading', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._atEnd(); if(!$core.assert($2)){ $1=$recv(self._collection())._at_($recv(self._position()).__plus((1))); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"] }), $globals.Stream); @@ -24021,9 +17977,7 @@ selector: "position", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@position"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -24033,15 +17987,11 @@ $1=self["@position"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "position\x0a\x09^ position ifNil: [ position := 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:"] }), $globals.Stream); @@ -24056,11 +18006,9 @@ self["@position"]=anInteger; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "position: anInteger\x0a\x09position := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Stream); @@ -24071,20 +18019,14 @@ selector: "reset", protocol: 'actions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._position_((0)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "reset\x0a\x09self position: 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["position:"] }), $globals.Stream); @@ -24095,21 +18037,15 @@ selector: "resetContents", protocol: 'actions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._reset(); self._setStreamSize_((0)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["reset", "setStreamSize:"] }), $globals.Stream); @@ -24124,11 +18060,9 @@ self["@collection"]=aCollection; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "setCollection: aCollection\x0a\x09collection := aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Stream); @@ -24143,11 +18077,9 @@ self["@streamSize"]=anInteger; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Stream); @@ -24158,20 +18090,14 @@ selector: "setToEnd", protocol: 'positioning', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._position_(self._size()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setToEnd\x0a\x09self position: self size", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["position:", "size"] }), $globals.Stream); @@ -24182,21 +18108,15 @@ selector: "size", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._streamSize(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "size\x0a\x09^ self streamSize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["streamSize"] }), $globals.Stream); @@ -24207,20 +18127,14 @@ selector: "skip:", protocol: 'positioning', fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["position:", "min:max:", "+", "position", "size"] }), $globals.Stream); @@ -24236,39 +18150,13 @@ $1=self["@streamSize"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "streamSize\x0a\x09^ streamSize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Stream); -$core.addMethod( -$core.method({ -selector: "write:", -protocol: 'writing', -fn: function (anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(anObject)._putOn_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.Stream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "write: anObject\x0a\x09anObject putOn: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["putOn:"] -}), -$globals.Stream); - $core.addMethod( $core.method({ @@ -24276,9 +18164,7 @@ selector: "on:", protocol: 'instance creation', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._setCollection_(aCollection); @@ -24286,24 +18172,18 @@ $recv($2)._setStreamSize_($recv(aCollection)._size()); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"] }), $globals.Stream.klass); $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.StringStream.comment="I am a Stream specific to `String` objects."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "cr", @@ -24311,21 +18191,15 @@ protocol: 'writing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._nextPutAll_($recv($String())._cr()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "cr\x0a\x09^ self nextPutAll: String cr", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "cr"] }), $globals.StringStream); @@ -24337,21 +18211,15 @@ protocol: 'writing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._nextPutAll_($recv($String())._crlf()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "crlf\x0a\x09^ self nextPutAll: String crlf", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "crlf"] }), $globals.StringStream); @@ -24363,21 +18231,15 @@ protocol: 'writing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._nextPutAll_($recv($String())._lf()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "lf\x0a\x09^ self nextPutAll: String lf", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "lf"] }), $globals.StringStream); @@ -24389,35 +18251,25 @@ protocol: 'reading', fn: function (anInteger){ var self=this; var tempCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; tempCollection=$recv($recv(self._collection())._class())._new(); $recv(anInteger)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=self._atEnd(); if(!$core.assert($1)){ tempCollection=$recv(tempCollection).__comma(self._next()); return tempCollection; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=tempCollection; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"] }), $globals.StringStream); @@ -24428,20 +18280,14 @@ selector: "nextPut:", protocol: 'writing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._nextPutAll_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "nextPut: aString\x0a\x09self nextPutAll: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:"] }), $globals.StringStream); @@ -24453,87 +18299,53 @@ protocol: 'writing', fn: function (aString){ var self=this; var pre,post; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13; $1=self._atEnd(); if($core.assert($1)){ $3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); self._setCollection_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["setCollection:"]=1; -//>>excludeEnd("ctx"); } else { $4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); $5=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=1; -//>>excludeEnd("ctx"); pre=$recv($4)._copyFrom_to_((1),$5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["copyFrom:to:"]=1; -//>>excludeEnd("ctx"); pre; $6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); $9=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=2; -//>>excludeEnd("ctx"); $8=$recv($9).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["+"]=2; -//>>excludeEnd("ctx"); $10=$recv(aString)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); $7=$recv($8).__plus($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["+"]=1; -//>>excludeEnd("ctx"); $11=$recv(self._collection())._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["size"]=2; -//>>excludeEnd("ctx"); post=$recv($6)._copyFrom_to_($7,$11); post; $12=$recv($recv(pre).__comma(aString)).__comma(post); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); self._setCollection_($12); }; $14=self._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["position"]=3; -//>>excludeEnd("ctx"); $13=$recv($14).__plus($recv(aString)._size()); self._position_($13); self._setStreamSize_($recv(self._streamSize())._max_(self._position())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"] }), $globals.StringStream); @@ -24544,20 +18356,14 @@ selector: "nextPutString:", protocol: 'writing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._nextPutAll_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "nextPutString: aString\x0a\x09self nextPutAll: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:"] }), $globals.StringStream); @@ -24568,20 +18374,14 @@ selector: "space", protocol: 'writing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._nextPut_(" "); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "space\x0a\x09self nextPut: ' '", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPut:"] }), $globals.StringStream); @@ -24593,166 +18393,346 @@ protocol: 'writing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._nextPutAll_($recv($String())._tab()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "tab\x0a\x09^ self nextPutAll: String tab", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "tab"] }), $globals.StringStream); -}); - -define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Kernel-Infrastructure'); -$core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"}; -$core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."; -//>>excludeEnd("ide"); +$core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections'); +$globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."; $core.addMethod( $core.method({ -selector: "=", -protocol: 'comparing', -fn: function (anObject){ +selector: "initialize", +protocol: 'initialization', +fn: function (){ var self=this; -function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3; -$2=$recv(anObject)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq_eq(self._class()); -if(!$core.assert($1)){ -return false; -}; -$3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject); -return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); +( +$ctx1.supercall = true, +$globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +self["@read"]=$recv($OrderedCollection())._new(); +$ctx1.sendIdx["new"]=1; +self["@write"]=$recv($OrderedCollection())._new(); +self["@readIndex"]=(1); +return self; +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject", -referencedClasses: ["JSObjectProxy"], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"] +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1", +referencedClasses: ["OrderedCollection"], +messageSends: ["initialize", "new"] }), -$globals.JSObjectProxy); +$globals.Queue); $core.addMethod( $core.method({ -selector: "asJSON", -protocol: 'enumerating', +selector: "next", +protocol: 'accessing', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@jsObject"]; +$1=self._nextIfAbsent_((function(){ +return $core.withContext(function($ctx2) { +return self._error_("Cannot read from empty Queue."); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); return $1; - +}, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject", +source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextIfAbsent:", "error:"] }), -$globals.JSObjectProxy); +$globals.Queue); $core.addMethod( $core.method({ -selector: "at:", +selector: "nextIfAbsent:", protocol: 'accessing', -fn: function (aString){ +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var result; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return self['@jsObject'][aString]; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); +var $1,$2,$3,$4; +var $early={}; +try { +result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){ +return $core.withContext(function($ctx2) { +$1=$recv(self["@write"])._isEmpty(); +if($core.assert($1)){ +$2=$recv(self["@readIndex"]).__gt((1)); +if($core.assert($2)){ +self["@read"]=[]; +self["@read"]; +self["@readIndex"]=(1); +self["@readIndex"]; +}; +$3=$recv(aBlock)._value(); +throw $early=[$3]; +}; +self["@read"]=self["@write"]; +self["@read"]; +self["@readIndex"]=(1); +self["@readIndex"]; +self["@write"]=$recv($OrderedCollection())._new(); +self["@write"]; +return $recv(self["@read"])._first(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$recv(self["@read"])._at_put_(self["@readIndex"],nil); +self["@readIndex"]=$recv(self["@readIndex"]).__plus((1)); +$4=result; +return $4; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "at: aString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aBlock"], +source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result", +referencedClasses: ["OrderedCollection"], +messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"] }), -$globals.JSObjectProxy); +$globals.Queue); $core.addMethod( $core.method({ -selector: "at:ifAbsent:", +selector: "nextPut:", protocol: 'accessing', -fn: function (aString,aBlock){ +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); - - var obj = self['@jsObject']; - return aString in obj ? obj[aString] : aBlock._value(); - ; +$recv(self["@write"])._add_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aBlock"], -source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>", +args: ["anObject"], +source: "nextPut: anObject\x0a\x09write add: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["add:"] }), -$globals.JSObjectProxy); +$globals.Queue); + + +$core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections'); +$globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object."; $core.addMethod( $core.method({ -selector: "at:ifPresent:", -protocol: 'accessing', -fn: function (aString,aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +selector: "compile:", +protocol: 'evaluating', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +return self.compile(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)}); +}, +args: ["aString"], +source: "compile: aString\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.RegularExpression); + +$core.addMethod( +$core.method({ +selector: "exec:", +protocol: 'evaluating', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +return self.exec(aString) || nil; +return self; +}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)}); +}, +args: ["aString"], +source: "exec: aString\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.RegularExpression); + +$core.addMethod( +$core.method({ +selector: "test:", +protocol: 'evaluating', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +return self.test(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)}); +}, +args: ["aString"], +source: "test: aString\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.RegularExpression); + + +$core.addMethod( +$core.method({ +selector: "fromString:", +protocol: 'instance creation', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._fromString_flag_(aString,""); +return $1; +}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)}); +}, +args: ["aString"], +source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''", +referencedClasses: [], +messageSends: ["fromString:flag:"] +}), +$globals.RegularExpression.klass); + +$core.addMethod( +$core.method({ +selector: "fromString:flag:", +protocol: 'instance creation', +fn: function (aString,anotherString){ +var self=this; +return $core.withContext(function($ctx1) { +return new RegExp(aString, anotherString); +return self; +}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)}); +}, +args: ["aString", "anotherString"], +source: "fromString: aString flag: anotherString\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.RegularExpression.klass); + +}); + +define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Kernel-Infrastructure'); +$core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"}; + +$core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure'); +$globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."; +$core.addMethod( +$core.method({ +selector: "=", +protocol: 'comparing', +fn: function (anObject){ +var self=this; +function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} +return $core.withContext(function($ctx1) { +var $2,$1,$3; +$2=$recv(anObject)._class(); +$ctx1.sendIdx["class"]=1; +$1=$recv($2).__eq_eq(self._class()); +if(!$core.assert($1)){ +return false; +}; +$3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject); +return $3; +}, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)}); +}, +args: ["anObject"], +source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject", +referencedClasses: ["JSObjectProxy"], +messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"] +}), +$globals.JSObjectProxy); + +$core.addMethod( +$core.method({ +selector: "asJSON", +protocol: 'enumerating', +fn: function (){ +var self=this; +var $1; +$1=self["@jsObject"]; +return $1; + +}, +args: [], +source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject", +referencedClasses: [], +messageSends: [] +}), +$globals.JSObjectProxy); + +$core.addMethod( +$core.method({ +selector: "at:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +return self['@jsObject'][aString]; +return self; +}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)}); +}, +args: ["aString"], +source: "at: aString\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.JSObjectProxy); + +$core.addMethod( +$core.method({ +selector: "at:ifAbsent:", +protocol: 'accessing', +fn: function (aString,aBlock){ +var self=this; +return $core.withContext(function($ctx1) { + + var obj = self['@jsObject']; + return aString in obj ? obj[aString] : aBlock._value(); + ; +return self; +}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)}); +}, +args: ["aString", "aBlock"], +source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>", +referencedClasses: [], +messageSends: [] +}), +$globals.JSObjectProxy); + +$core.addMethod( +$core.method({ +selector: "at:ifPresent:", +protocol: 'accessing', +fn: function (aString,aBlock){ +var self=this; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var obj = self['@jsObject']; return aString in obj ? aBlock._value_(obj[aString]) : nil; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aBlock"], source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); @@ -24763,23 +18743,17 @@ selector: "at:ifPresent:ifAbsent:", protocol: 'accessing', fn: function (aString,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var obj = self['@jsObject']; return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value(); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aBlock", "anotherBlock"], source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); @@ -24790,20 +18764,14 @@ selector: "at:put:", protocol: 'accessing', fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self['@jsObject'][aString] = anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "at: aString put: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); @@ -24815,67 +18783,45 @@ protocol: 'proxy', fn: function (aMessage){ var self=this; function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self); if(($receiver = $2) == null || $receiver.isNil){ $1=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; } else { var jsSelector; jsSelector=$receiver; $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMessage"], source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]", referencedClasses: ["JSObjectProxy"], -//>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ -selector: "inspectOn:", -protocol: 'proxy', -fn: function (anInspector){ +selector: "in:", +protocol: 'accessing', +fn: function (aValuable){ var self=this; -var variables; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -variables=$recv($Dictionary())._new(); -$recv(variables)._at_put_("#self",self._jsObject()); -$recv(anInspector)._setLabel_(self._printString()); -$recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self); -$recv(anInspector)._setVariables_(variables); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(aValuable)._value_(self["@jsObject"]); +return $1; +}, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInspector"], -source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables", -referencedClasses: ["Dictionary", "JSObjectProxy"], -//>>excludeEnd("ide"); -messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"] +args: ["aValuable"], +source: "in: aValuable\x0a\x09^ aValuable value: jsObject", +referencedClasses: [], +messageSends: ["value:"] }), $globals.JSObjectProxy); @@ -24890,11 +18836,9 @@ $1=self["@jsObject"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "jsObject\x0a\x09^ jsObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); @@ -24905,9 +18849,7 @@ selector: "keysAndValuesDo:", protocol: 'enumerating', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var o = self['@jsObject']; for(var i in o) { @@ -24915,15 +18857,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); @@ -24934,20 +18872,14 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._printString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["nextPutAll:", "printString"] }), $globals.JSObjectProxy); @@ -24958,9 +18890,7 @@ selector: "printString", protocol: 'printing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var js = self['@jsObject']; return js.toString @@ -24968,19 +18898,33 @@ return $core.withContext(function($ctx1) { : Object.prototype.toString.call(js) ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); +$core.addMethod( +$core.method({ +selector: "putOn:", +protocol: 'streaming', +fn: function (aStream){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aStream)._nextPutJSObject_(self["@jsObject"]); +return self; +}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)}); +}, +args: ["aStream"], +source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject", +referencedClasses: [], +messageSends: ["nextPutJSObject:"] +}), +$globals.JSObjectProxy); + $core.addMethod( $core.method({ @@ -24988,9 +18932,7 @@ selector: "addObjectVariablesTo:ofProxy:", protocol: 'proxy', fn: function (aDictionary,aProxy){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var jsObject = aProxy['@jsObject']; for(var i in jsObject) { @@ -24998,15 +18940,11 @@ return $core.withContext(function($ctx1) { } ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDictionary", "aProxy"], source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<\x0a\x09\x09var jsObject = aProxy['@jsObject'];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.klass); @@ -25017,22 +18955,16 @@ selector: "compareJSObjectOfProxy:withProxy:", protocol: 'proxy', fn: function (aProxy,anotherProxy){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy; return aProxy["@jsObject"] === anotherJSObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aProxy", "anotherProxy"], source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.klass); @@ -25043,22 +18975,16 @@ selector: "forwardMessage:withArguments:ofProxy:", protocol: 'proxy', fn: function (aString,anArray,aProxy){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.accessJavaScript(aProxy._jsObject(), aString, anArray); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anArray", "aProxy"], source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.klass); @@ -25069,20 +18995,14 @@ selector: "jsObject:ofProxy:", protocol: 'proxy', fn: function (aJSObject,aProxy){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); aProxy['@jsObject'] = aJSObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aJSObject", "aProxy"], source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.klass); @@ -25093,20 +19013,14 @@ selector: "lookupProperty:ofProxy:", protocol: 'proxy', fn: function (aString,aProxy){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return aString in aProxy._jsObject() ? aString : nil; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aProxy"], source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.klass); @@ -25118,52 +19032,38 @@ protocol: 'instance creation', fn: function (aJSObject){ var self=this; var instance; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; instance=self._new(); self._jsObject_ofProxy_(aJSObject,instance); $1=instance; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aJSObject"], source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["new", "jsObject:ofProxy:"] }), $globals.JSObjectProxy.klass); $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addElement:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.elements.addElement(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "addElement: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Organizer); @@ -25174,21 +19074,15 @@ selector: "elements", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._basicAt_("elements"))._copy(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "elements\x0a\x09^ (self basicAt: 'elements') copy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["copy", "basicAt:"] }), $globals.Organizer); @@ -25199,20 +19093,14 @@ selector: "removeElement:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.elements.removeElement(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "removeElement: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Organizer); @@ -25220,9 +19108,7 @@ $globals.Organizer); $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addElement:", @@ -25231,33 +19117,23 @@ fn: function (aString){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $1=$recv($ProtocolAdded())._new(); $recv($1)._protocol_(aString); $recv($1)._theClass_(self._theClass()); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ProtocolAdded"], -//>>excludeEnd("ide"); messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"] }), $globals.ClassOrganizer); @@ -25270,33 +19146,23 @@ fn: function (aString){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $1=$recv($ProtocolRemoved())._new(); $recv($1)._protocol_(aString); $recv($1)._theClass_(self._theClass()); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"], -//>>excludeEnd("ide"); messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"] }), $globals.ClassOrganizer); @@ -25307,20 +19173,14 @@ selector: "theClass", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.theClass ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theClass\x0a\x09< return self.theClass >", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassOrganizer); @@ -25328,35 +19188,25 @@ $globals.ClassOrganizer); $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information."; -//>>excludeEnd("ide"); $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "basicImports", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.imports || []; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Package); @@ -25367,20 +19217,14 @@ selector: "basicName:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.pkgName = aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basicName: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Package); @@ -25391,20 +19235,14 @@ selector: "basicTransport", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.transport; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Package); @@ -25417,9 +19255,7 @@ fn: function (){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self["@dirty"]=false; $1=$recv($PackageClean())._new(); @@ -25427,15 +19263,11 @@ $recv($1)._package_(self); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "PackageClean"], -//>>excludeEnd("ide"); messageSends: ["announce:", "current", "package:", "new", "yourself"] }), $globals.Package); @@ -25448,9 +19280,7 @@ fn: function (){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; self["@dirty"]=true; $1=$recv($PackageDirty())._new(); @@ -25458,15 +19288,11 @@ $recv($1)._package_(self); $2=$recv($1)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "PackageDirty"], -//>>excludeEnd("ide"); messageSends: ["announce:", "current", "package:", "new", "yourself"] }), $globals.Package); @@ -25478,75 +19304,43 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$4,$2,$5,$6,$7,$1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("Object"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $3=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); $4=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); $5; $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("package: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(self._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); $7=$recv(stream)._nextPutAll_("'"); return $7; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"] }), $globals.Package); @@ -25557,21 +19351,15 @@ selector: "classes", protocol: 'classes', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._organization())._elements(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classes\x0a\x09^ self organization elements", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["elements", "organization"] }), $globals.Package); @@ -25583,106 +19371,58 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(self._class())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $4=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); $5=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__comma($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("named: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); $7="'".__comma(self._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); $6=$recv($7).__comma("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); $9=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); $10=$recv($String())._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=2; -//>>excludeEnd("ctx"); $8=$recv($9).__comma($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=4; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("imports: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_(self._importsDefinition()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); $11=$recv($recv($String())._lf()).__comma($recv($String())._tab()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=5; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("transport: ("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")")); return $12; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'imports: ';\x0a\x09\x09\x09nextPutAll: self importsDefinition;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"] }), $globals.Package); @@ -25693,9 +19433,7 @@ selector: "imports", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@imports"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -25708,15 +19446,11 @@ $1=self["@imports"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"] }), $globals.Package); @@ -25727,21 +19461,15 @@ selector: "imports:", protocol: 'accessing', fn: function (anArray){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._validateImports_(anArray); self["@imports"]=$recv(anArray)._asSet(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArray"], source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["validateImports:", "asSet"] }), $globals.Package); @@ -25752,37 +19480,25 @@ selector: "importsAsJson", protocol: 'converting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $1=$recv(self._sortedImportsAsArray())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(each)._isString(); if($core.assert($2)){ return each; } else { return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"] }), $globals.Package); @@ -25794,56 +19510,32 @@ protocol: 'accessing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(stream)._nextPutAll_("{"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_($recv(each)._importsString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv(stream)._nextPutAll_(". "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); })); return $recv(stream)._nextPutAll_("}"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each importsString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"] }), $globals.Package); @@ -25854,40 +19546,28 @@ selector: "importsFromJson:", protocol: 'converting', fn: function (anArray){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $1=$recv(anArray)._collect_((function(each){ var split; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); split=$recv(each)._tokenize_("="); split; $2=$recv($recv(split)._size()).__eq((1)); if($core.assert($2)){ return $recv(split)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["first"]=1; -//>>excludeEnd("ctx"); } else { return $recv($recv(split)._first()).__minus_gt($recv(split)._second()); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArray"], source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"] }), $globals.Package); @@ -25898,9 +19578,7 @@ selector: "isDirty", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@dirty"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -25909,15 +19587,11 @@ $1=false; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isDirty\x0a\x09^ dirty ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:"] }), $globals.Package); @@ -25931,11 +19605,9 @@ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isPackage\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Package); @@ -25947,19 +19619,13 @@ protocol: 'dependencies', fn: function (){ var self=this; var classes,packages; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; classes=self._loadDependencyClasses(); $2=$recv($recv(classes)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._asSet(); $recv($2)._remove_ifAbsent_(self,(function(){ @@ -25967,15 +19633,11 @@ $recv($2)._remove_ifAbsent_(self,(function(){ $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"] }), $globals.Package); @@ -25988,57 +19650,37 @@ fn: function (){ var self=this; var starCategoryName; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $4,$3,$2,$6,$5,$7,$1; starCategoryName="*".__comma(self._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $4=self._classes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["classes"]=1; -//>>excludeEnd("ctx"); $3=$recv($4)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=$recv($3)._asSet(); $recv($2)._remove_ifAbsent_(nil,(function(){ })); $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $6=$recv(each)._protocols(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["protocols"]=1; -//>>excludeEnd("ctx"); $5=$recv($6).__comma($recv($recv(each)._class())._protocols()); return $recv($5)._includes_(starCategoryName); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); }))); $7=$recv($2)._yourself(); $1=$7; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"] }), $globals.Package); @@ -26049,20 +19691,14 @@ selector: "name", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.pkgName; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "name\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Package); @@ -26073,21 +19709,15 @@ selector: "name:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._basicName_(aString); self._beDirty(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicName:", "beDirty"] }), $globals.Package); @@ -26098,21 +19728,15 @@ selector: "organization", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._basicAt_("organization"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "organization\x0a\x09^ self basicAt: 'organization'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["basicAt:"] }), $globals.Package); @@ -26123,37 +19747,23 @@ selector: "printOn:", protocol: 'printing', fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $recv(aStream)._nextPutAll_(" ("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_(self._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); $1=$recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["printOn:", "nextPutAll:", "name"] }), $globals.Package); @@ -26165,42 +19775,26 @@ protocol: 'classes', fn: function (){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=self._classes(); $recv($1)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv($ClassBuilder())._new())._setupClass_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); $2=$recv($1)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._initialize(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["do:", "classes", "setupClass:", "new", "initialize"] }), $globals.Package); @@ -26211,21 +19805,15 @@ selector: "sortedClasses", protocol: 'classes', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._class())._sortedClasses_(self._classes()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sortedClasses:", "class", "classes"] }), $globals.Package); @@ -26236,64 +19824,38 @@ selector: "sortedImportsAsArray", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $4,$3,$5,$2,$7,$6,$8,$1; $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(a)._isString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["isString"]=1; -//>>excludeEnd("ctx"); $3=$recv($4)._not(); $5=$recv(b)._isString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["isString"]=2; -//>>excludeEnd("ctx"); $2=$recv($3).__and($5); return $recv($2)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); $7=$recv(a)._isString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["isString"]=3; -//>>excludeEnd("ctx"); $6=$recv($7).__eq($recv(b)._isString()); return $recv($6)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); $8=$recv(a)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx4.sendIdx["value"]=1; -//>>excludeEnd("ctx"); return $recv($8).__lt_eq($recv(b)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"] }), $globals.Package); @@ -26305,9 +19867,7 @@ protocol: 'accessing', fn: function (){ var self=this; function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$4,$1,$receiver; $2=self["@transport"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -26320,15 +19880,11 @@ $1=self["@transport"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]", referencedClasses: ["PackageTransport"], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"] }), $globals.Package); @@ -26339,21 +19895,15 @@ selector: "transport:", protocol: 'accessing', fn: function (aPackageTransport){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@transport"]=aPackageTransport; $recv(aPackageTransport)._package_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackageTransport"], source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["package:"] }), $globals.Package); @@ -26364,60 +19914,40 @@ selector: "validateImports:", protocol: 'validation', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$5,$4,$3,$6; $recv(aCollection)._do_((function(import_){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(import_)._isString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["isString"]=1; -//>>excludeEnd("ctx"); if(!$core.assert($1)){ $2=$recv(import_)._respondsTo_("key"); if(!$core.assert($2)){ self._error_("Imports must be Strings or Associations"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["error:"]=1; -//>>excludeEnd("ctx"); }; $5=$recv(import_)._key(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["key"]=1; -//>>excludeEnd("ctx"); $4=$recv($5)._isString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["isString"]=2; -//>>excludeEnd("ctx"); $3=$recv($4).__and($recv($recv(import_)._value())._isString()); if(!$core.assert($3)){ self._error_("Key and value must be Strings"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["error:"]=2; -//>>excludeEnd("ctx"); }; $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$"); if(!$core.assert($6)){ return self._error_("Keys must be identifiers"); }; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"] }), $globals.Package); @@ -26431,29 +19961,19 @@ protocol: 'accessing', fn: function (aPackageName){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($Smalltalk())._createPackage_(aPackageName); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackageName"], source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["packageAt:ifAbsent:", "createPackage:"] }), $globals.Package.klass); @@ -26465,21 +19985,15 @@ protocol: 'accessing', fn: function (aPackageName,aBlock){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackageName", "aBlock"], source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["packageAt:ifAbsent:"] }), $globals.Package.klass); @@ -26491,24 +20005,18 @@ protocol: 'accessing', fn: function (aPackageName,anArray,aTransport){ var self=this; var package_; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; package_=self._named_(aPackageName); $recv(package_)._imports_(anArray); $recv(package_)._transport_(aTransport); $1=package_; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackageName", "anArray", "aTransport"], source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["named:", "imports:", "transport:"] }), $globals.Package.klass); @@ -26520,23 +20028,17 @@ protocol: 'accessing', fn: function (aPackageName,aTransport){ var self=this; var package_; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; package_=self._named_(aPackageName); $recv(package_)._transport_(aTransport); $1=package_; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackageName", "aTransport"], source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["named:", "transport:"] }), $globals.Package.klass); @@ -26550,88 +20052,56 @@ var self=this; var children,others,nodes,expandedClasses; function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)} function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$2,$4; children=[]; others=[]; $recv(classes)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(classes)._includes_($recv(each)._superclass()); if($core.assert($1)){ return $recv(others)._add_(each); } else { return $recv(children)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); nodes=$recv(children)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($ClassSorterNode())._on_classes_level_(each,others,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); })); nodes=$recv(nodes)._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=$recv(a)._theClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["theClass"]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["name"]=1; -//>>excludeEnd("ctx"); return $recv($2).__lt_eq($recv($recv(b)._theClass())._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)}); -//>>excludeEnd("ctx"); })); expandedClasses=$recv($Array())._new(); $recv(nodes)._do_((function(aNode){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aNode)._traverseClassesWith_(expandedClasses); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)}); -//>>excludeEnd("ctx"); })); $4=expandedClasses; return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["classes"], source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses", referencedClasses: ["ClassSorterNode", "Array"], -//>>excludeEnd("ide"); messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"] }), $globals.Package.klass); $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "announcer", @@ -26639,21 +20109,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($SystemAnnouncer())._current(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "announcer\x0a\x09^ SystemAnnouncer current", referencedClasses: ["SystemAnnouncer"], -//>>excludeEnd("ide"); messageSends: ["current"] }), $globals.PackageStateObserver); @@ -26668,34 +20132,22 @@ function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="un function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)} function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)} function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=self._announcer(); $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:send:to:"]=1; -//>>excludeEnd("ctx"); $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:send:to:"]=2; -//>>excludeEnd("ctx"); $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:send:to:"]=3; -//>>excludeEnd("ctx"); $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self", referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"], -//>>excludeEnd("ide"); messageSends: ["on:send:to:", "announcer"] }), $globals.PackageStateObserver); @@ -26706,9 +20158,7 @@ selector: "onClassModification:", protocol: 'reactions', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=$recv(anAnnouncement)._theClass(); if(($receiver = $1) == null || $receiver.isNil){ @@ -26719,15 +20169,11 @@ theClass=$receiver; $recv($recv(theClass)._package())._beDirty(); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "theClass", "beDirty", "package"] }), $globals.PackageStateObserver); @@ -26738,9 +20184,7 @@ selector: "onMethodModification:", protocol: 'reactions', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=$recv($recv(anAnnouncement)._method())._package(); if(($receiver = $1) == null || $receiver.isNil){ @@ -26751,15 +20195,11 @@ package_=$receiver; $recv(package_)._beDirty(); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "package", "method", "beDirty"] }), $globals.PackageStateObserver); @@ -26770,20 +20210,14 @@ selector: "onPackageAdded:", protocol: 'reactions', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(anAnnouncement)._package())._beDirty(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["beDirty", "package"] }), $globals.PackageStateObserver); @@ -26794,9 +20228,7 @@ selector: "onProtocolModification:", protocol: 'reactions', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=$recv(anAnnouncement)._package(); if(($receiver = $1) == null || $receiver.isNil){ @@ -26807,15 +20239,11 @@ package_=$receiver; $recv(package_)._beDirty(); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "package", "beDirty"] }), $globals.PackageStateObserver); @@ -26828,9 +20256,7 @@ selector: "current", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@current"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -26840,15 +20266,11 @@ $1=self["@current"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "current\x0a\x09^ current ifNil: [ current := self new ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.PackageStateObserver.klass); @@ -26859,29 +20281,21 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._observeSystem(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09self current observeSystem", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["observeSystem", "current"] }), $globals.PackageStateObserver.klass); $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "defaultValue", @@ -26893,11 +20307,9 @@ $1=self["@defaultValue"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultValue\x0a\x09^ defaultValue", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Setting); @@ -26912,11 +20324,9 @@ self["@defaultValue"]=aStringifiableObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStringifiableObject"], source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Setting); @@ -26932,11 +20342,9 @@ $1=self["@key"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "key\x0a\x09^ key", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Setting); @@ -26951,11 +20359,9 @@ self["@key"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "key: aString\x0a\x09key := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Setting); @@ -26967,29 +20373,19 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._defaultValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"] }), $globals.Setting); @@ -27001,21 +20397,15 @@ protocol: 'accessing', fn: function (aStringifiableObject){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStringifiableObject"], source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["at:put:", "settings", "key"] }), $globals.Setting); @@ -27027,32 +20417,22 @@ selector: "at:ifAbsent:", protocol: 'instance creation', fn: function (aString,aDefaultValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $recv($2)._key_(aString); $recv($2)._defaultValue_(aDefaultValue); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aDefaultValue"], source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["key:", "new", "defaultValue:", "yourself"] }), $globals.Setting.klass); @@ -27063,49 +20443,35 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._shouldNotImplement(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09self shouldNotImplement", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["shouldNotImplement"] }), $globals.Setting.klass); $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addGlobalJsVariable:", protocol: 'globals', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._globalJsVariables())._add_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "globalJsVariables"] }), $globals.SmalltalkImage); @@ -27116,21 +20482,15 @@ selector: "amdRequire", protocol: 'accessing amd', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._core())._at_("amdRequire"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "amdRequire\x0a\x09^ self core at: 'amdRequire'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:", "core"] }), $globals.SmalltalkImage); @@ -27143,18 +20503,12 @@ fn: function (anObject){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(anObject)._isKindOf_($Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); if($core.assert($2)){ $1=anObject; @@ -27162,15 +20516,11 @@ $1=anObject; $1=$recv($JavaScriptException())._on_(anObject); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]", referencedClasses: ["Error", "JavaScriptException"], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"] }), $globals.SmalltalkImage); @@ -27181,20 +20531,14 @@ selector: "basicCreatePackage:", protocol: 'private', fn: function (packageName){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.addPackage(packageName); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName"], source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27206,21 +20550,15 @@ protocol: 'private', fn: function (aString){ var self=this; function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($SmalltalkParser())._parse_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString", referencedClasses: ["SmalltalkParser"], -//>>excludeEnd("ide"); messageSends: ["parse:"] }), $globals.SmalltalkImage); @@ -27231,20 +20569,14 @@ selector: "basicRegisterPackage:", protocol: 'private', fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.packages[aPackage.pkgName]=aPackage; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackage"], source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27255,20 +20587,14 @@ selector: "cancelOptOut:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); delete anObject.klass; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27279,20 +20605,14 @@ selector: "classes", protocol: 'classes', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.classes(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classes\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27303,20 +20623,14 @@ selector: "core", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "core\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27330,9 +20644,7 @@ var self=this; var package_,announcement; function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)} function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; package_=self._basicCreatePackage_(packageName); $1=$recv($PackageAdded())._new(); @@ -27342,15 +20654,11 @@ announcement=$2; $recv($recv($SystemAnnouncer())._current())._announce_(announcement); $3=package_; return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName"], source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package", referencedClasses: ["PackageAdded", "SystemAnnouncer"], -//>>excludeEnd("ide"); messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"] }), $globals.SmalltalkImage); @@ -27361,21 +20669,15 @@ selector: "defaultAmdNamespace", protocol: 'accessing amd', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1="transport.defaultAmdNamespace"._settingValue(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["settingValue"] }), $globals.SmalltalkImage); @@ -27386,20 +20688,14 @@ selector: "defaultAmdNamespace:", protocol: 'accessing amd', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); "transport.defaultAmdNamespace"._settingValue_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["settingValue:"] }), $globals.SmalltalkImage); @@ -27410,20 +20706,14 @@ selector: "deleteClass:", protocol: 'private', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $core.removeClass(aClass); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27434,22 +20724,16 @@ selector: "deleteGlobalJsVariable:", protocol: 'globals', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){ })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["remove:ifAbsent:", "globalJsVariables"] }), $globals.SmalltalkImage); @@ -27460,44 +20744,58 @@ selector: "deletePackage:", protocol: 'private', fn: function (packageName){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); delete $core.packages[packageName]; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName"], source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); +$core.addMethod( +$core.method({ +selector: "existsJsGlobal:", +protocol: 'testing', +fn: function (aString){ +var self=this; +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){ +return true; + +}),(function(){ +return false; + +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)}); +}, +args: ["aString"], +source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]", +referencedClasses: ["Platform"], +messageSends: ["at:ifPresent:ifAbsent:", "globals"] +}), +$globals.SmalltalkImage); + $core.addMethod( $core.method({ selector: "globalJsVariables", protocol: 'globals', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.globalJsVariables; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27508,20 +20806,14 @@ selector: "globals", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $globals; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "globals\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27532,20 +20824,14 @@ selector: "includesKey:", protocol: 'accessing', fn: function (aKey){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.hasOwnProperty(aKey); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aKey"], source: "includesKey: aKey\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27556,20 +20842,14 @@ selector: "isSmalltalkObject:", protocol: 'testing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return typeof anObject.klass !== 'undefined'; +return anObject.klass != null; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], -source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09", +source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27580,20 +20860,14 @@ selector: "optOut:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); anObject.klass = null; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27604,20 +20878,14 @@ selector: "packageAt:", protocol: 'packages', fn: function (packageName){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.packages[packageName]; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName"], source: "packageAt: packageName\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27628,22 +20896,16 @@ selector: "packageAt:ifAbsent:", protocol: 'packages', fn: function (packageName,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=self._packageAt_(packageName); $1=$recv($2)._ifNil_(aBlock); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName", "aBlock"], source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "packageAt:"] }), $globals.SmalltalkImage); @@ -27654,24 +20916,18 @@ selector: "packages", protocol: 'packages', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return Object.keys($core.packages).map(function(k) { return $core.packages[k]; }) ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27683,42 +20939,28 @@ protocol: 'accessing', fn: function (aString){ var self=this; var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); result=self._basicParse_(aString); return result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._tryCatch_((function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._parseError_parsing_(ex,aString))._signal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $2=result; $recv($2)._source_(aString); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"] }), $globals.SmalltalkImage); @@ -27730,47 +20972,29 @@ protocol: 'error handling', fn: function (anException,aString){ var self=this; function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$8,$7,$6,$9,$5,$4,$3,$1; $2=$recv($ParseError())._new(); $8=$recv(anException)._basicAt_("line"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["basicAt:"]=1; -//>>excludeEnd("ctx"); $7="Parse error on line ".__comma($8); $6=$recv($7).__comma(" column "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); $9=$recv(anException)._basicAt_("column"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["basicAt:"]=2; -//>>excludeEnd("ctx"); $5=$recv($6).__comma($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); $4=$recv($5).__comma(" : Unexpected character "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $3=$recv($4).__comma($recv(anException)._basicAt_("found")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._messageText_($3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anException", "aString"], source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')", referencedClasses: ["ParseError"], -//>>excludeEnd("ide"); messageSends: ["messageText:", "new", ",", "basicAt:"] }), $globals.SmalltalkImage); @@ -27786,11 +21010,9 @@ $1=["self", "super", "nil", "true", "false", "thisContext"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27801,20 +21023,14 @@ selector: "readJSObject:", protocol: 'accessing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.readJSObject(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "readJSObject: anObject\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27827,9 +21043,7 @@ fn: function (aClass){ var self=this; function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; $1=$recv(aClass)._isMetaclass(); if($core.assert($1)){ @@ -27841,15 +21055,11 @@ $recv($2)._theClass_(aClass); $3=$recv($2)._yourself(); $recv($recv($SystemAnnouncer())._current())._announce_($3); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "ClassRemoved"], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"] }), $globals.SmalltalkImage); @@ -27861,38 +21071,24 @@ protocol: 'packages', fn: function (packageName){ var self=this; var pkg; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); pkg=self._packageAt_ifAbsent_(packageName,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._error_("Missing package: ".__comma(packageName)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $recv($recv(pkg)._classes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._removeClass_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); self._deletePackage_(packageName); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName"], source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"] }), $globals.SmalltalkImage); @@ -27904,25 +21100,15 @@ protocol: 'packages', fn: function (packageName,newName){ var self=this; var pkg; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; pkg=self._packageAt_ifAbsent_(packageName,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1="Missing package: ".__comma(packageName); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); return self._error_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["error:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=self._packageAt_(newName); if(($receiver = $2) == null || $receiver.isNil){ @@ -27934,15 +21120,11 @@ $recv(pkg)._name_(newName); self._basicRegisterPackage_(pkg); self._deletePackage_(packageName); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["packageName", "newName"], source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"] }), $globals.SmalltalkImage); @@ -27953,20 +21135,14 @@ selector: "reservedWords", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.reservedWords; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27981,11 +21157,9 @@ function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof Smallta return $SmalltalkSettings(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "settings\x0a\x09^ SmalltalkSettings", referencedClasses: ["SmalltalkSettings"], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -27999,11 +21173,9 @@ var self=this; return "0.15.0-pre"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SmalltalkImage); @@ -28016,35 +21188,25 @@ selector: "current", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@current"]; if(($receiver = $2) == null || $receiver.isNil){ self["@current"]=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $1=self["@current"]; } else { self._deprecatedAPI(); $1=self["@current"]; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"] }), $globals.SmalltalkImage.klass); @@ -28056,21 +21218,15 @@ protocol: 'initialization', fn: function (){ var self=this; var st; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); st=self._current(); $recv($recv(st)._globals())._at_put_("Smalltalk",st); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["current", "at:put:", "globals"] }), $globals.SmalltalkImage.klass); @@ -28081,20 +21237,14 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._shouldNotImplement(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09self shouldNotImplement", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["shouldNotImplement"] }), $globals.SmalltalkImage.klass); @@ -28105,29 +21255,19 @@ selector: "importsString", protocol: '*Kernel-Infrastructure', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; $3=$recv(self._key())._importsString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["importsString"]=1; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(" -> "); $1=$recv($2).__comma($recv(self._value())._importsString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "importsString\x0a\x09\x22This is for use by package exporter.\x0a\x09It can fail for non-string keys and values.\x22\x0a\x0a\x09^ self key importsString, ' -> ', self value importsString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "importsString", "key", "value"] }), $globals.Association); @@ -28138,20 +21278,14 @@ selector: "asJavaScriptPropertyName", protocol: '*Kernel-Infrastructure', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return $core.st2prop(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavaScriptPropertyName\x0a", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.String); @@ -28163,21 +21297,15 @@ protocol: '*Kernel-Infrastructure', fn: function (){ var self=this; function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Setting())._at_ifAbsent_(self,nil); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil", referencedClasses: ["Setting"], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:"] }), $globals.String); @@ -28189,21 +21317,15 @@ protocol: '*Kernel-Infrastructure', fn: function (aDefaultValue){ var self=this; function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDefaultValue"], source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue", referencedClasses: ["Setting"], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:"] }), $globals.String); @@ -28214,24 +21336,16 @@ selector: "importsString", protocol: '*Kernel-Infrastructure', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "replace:with:"] }), $globals.String); @@ -28242,21 +21356,15 @@ selector: "settingValue", protocol: '*Kernel-Infrastructure', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._asSetting())._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "settingValue\x0a\x09^ self asSetting value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value", "asSetting"] }), $globals.String); @@ -28267,21 +21375,15 @@ selector: "settingValue:", protocol: '*Kernel-Infrastructure', fn: function (aValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._asSetting())._value_(aValue); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aValue"], source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:", "asSetting"] }), $globals.String); @@ -28292,21 +21394,15 @@ selector: "settingValueIfAbsent:", protocol: '*Kernel-Infrastructure', fn: function (aDefaultValue){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDefaultValue"], source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value", "asSettingIfAbsent:"] }), $globals.String); @@ -28320,29 +21416,21 @@ $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(ex $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "beHandled", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.amberHandled = true; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beHandled\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28353,20 +21441,14 @@ selector: "beUnhandled", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.amberHandled = false; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beUnhandled\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28377,20 +21459,14 @@ selector: "context", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.context; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "context\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28401,20 +21477,14 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._messageText_("Errorclass: ".__comma($recv(self._class())._name())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["messageText:", ",", "name", "class"] }), $globals.Error); @@ -28425,20 +21495,14 @@ selector: "isSmalltalkError", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.smalltalkError === true; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSmalltalkError\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28449,20 +21513,14 @@ selector: "jsStack", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.stack; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "jsStack\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28478,11 +21536,9 @@ $1=self["@messageText"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "messageText\x0a\x09^ messageText", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28497,11 +21553,9 @@ self["@messageText"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "messageText: aString\x0a\x09messageText := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28512,23 +21566,17 @@ selector: "resignal", protocol: 'signaling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.amberHandled = false; throw(self); ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28539,9 +21587,7 @@ selector: "signal", protocol: 'signaling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.amberHandled = false; self.context = $core.getThisContext(); @@ -28549,15 +21595,11 @@ return $core.withContext(function($ctx1) { throw self; ; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28568,21 +21610,15 @@ selector: "signal:", protocol: 'signaling', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._messageText_(aString); self._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["messageText:", "signal"] }), $globals.Error); @@ -28593,21 +21629,15 @@ selector: "signalerContext", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._signalerContextFrom_(self._context()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "signalerContext\x0a\x09^ self signalerContextFrom: self context", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["signalerContextFrom:", "context"] }), $globals.Error); @@ -28618,46 +21648,28 @@ selector: "signalerContextFrom:", protocol: 'accessing', fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $4,$3,$2,$1; $1=$recv(aContext)._findContextSuchThat_((function(context){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(context)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__eq_eq(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["=="]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv($recv(context)._receiver()).__eq_eq(self._class()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); return $recv($2)._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aContext"], source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"] }), $globals.Error); @@ -28668,20 +21680,14 @@ selector: "wasHandled", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return self.amberHandled || false; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "wasHandled\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error); @@ -28696,11 +21702,9 @@ var self=this; return "exception"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Error.klass); @@ -28711,21 +21715,15 @@ selector: "signal", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._new())._signal(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "signal\x0a\x09^ self new signal", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["signal", "new"] }), $globals.Error.klass); @@ -28736,30 +21734,22 @@ selector: "signal:", protocol: 'instance creation', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._new())._signal_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["signal:", "new"] }), $globals.Error.klass); $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Halt.comment="I am provided to support `Object>>#halt`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "messageText", @@ -28769,11 +21759,9 @@ var self=this; return "Halt encountered"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "messageText\x0a\x09^ 'Halt encountered'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Halt); @@ -28784,57 +21772,33 @@ selector: "signalerContextFrom:", protocol: 'accessing', fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $4,$3,$2,$1; $1=$recv(aContext)._findContextSuchThat_((function(context){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(context)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); $3=$recv($4).__eq_eq(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["=="]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); return $recv($recv($recv(context)._method())._selector()).__eq("halt"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["or:"]=1; -//>>excludeEnd("ctx"); return $recv($2)._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aContext"], source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"] }), $globals.Halt); @@ -28842,29 +21806,21 @@ $globals.Halt); $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "context:", protocol: 'accessing', fn: function (aMethodContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self.context = aMethodContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethodContext"], source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JavaScriptException); @@ -28880,11 +21836,9 @@ $1=self["@exception"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "exception\x0a\x09^ exception", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JavaScriptException); @@ -28899,11 +21853,9 @@ self["@exception"]=anException; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anException"], source: "exception: anException\x0a\x09exception := anException", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JavaScriptException); @@ -28914,20 +21866,14 @@ selector: "messageText", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return 'JavaScript exception: ' + self["@exception"].toString(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "messageText\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.JavaScriptException); @@ -28939,24 +21885,18 @@ selector: "on:", protocol: 'instance creation', fn: function (anException){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._exception_(anException); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anException"], source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["exception:", "new", "yourself"] }), $globals.JavaScriptException.klass); @@ -28967,9 +21907,7 @@ selector: "on:context:", protocol: 'instance creation', fn: function (anException,aMethodContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._exception_(anException); @@ -28977,24 +21915,18 @@ $recv($2)._context_(aMethodContext); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anException", "aMethodContext"], source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["exception:", "new", "context:", "yourself"] }), $globals.JavaScriptException.klass); $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "message", @@ -29006,11 +21938,9 @@ $1=self["@message"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "message\x0a\x09^ message", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageNotUnderstood); @@ -29025,11 +21955,9 @@ self["@message"]=aMessage; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMessage"], source: "message: aMessage\x0a\x09message := aMessage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageNotUnderstood); @@ -29040,24 +21968,16 @@ selector: "messageText", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "asString", "receiver", "selector", "message"] }), $globals.MessageNotUnderstood); @@ -29073,11 +21993,9 @@ $1=self["@receiver"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageNotUnderstood); @@ -29092,11 +22010,9 @@ self["@receiver"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "receiver: anObject\x0a\x09receiver := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MessageNotUnderstood); @@ -29104,9 +22020,7 @@ $globals.MessageNotUnderstood); $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "object", @@ -29118,11 +22032,9 @@ $1=self["@object"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "object\x0a\x09^ object", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NonBooleanReceiver); @@ -29137,22 +22049,14 @@ self["@object"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "object: anObject\x0a\x09object := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.NonBooleanReceiver); - -$core.addClass('PackageCommitError', $globals.Error, [], 'Kernel-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed."; -//>>excludeEnd("ide"); - }); define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){ @@ -29162,9 +22066,7 @@ $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "announcementClass", @@ -29176,11 +22078,9 @@ $1=self["@announcementClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "announcementClass\x0a\x09^ announcementClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementSubscription); @@ -29195,11 +22095,9 @@ self["@announcementClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "announcementClass: aClass\x0a\x09announcementClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementSubscription); @@ -29210,24 +22108,18 @@ selector: "deliver:", protocol: 'announcing', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._handlesAnnouncement_(anAnnouncement); if($core.assert($1)){ $recv(self._valuable())._value_(anAnnouncement); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"] }), $globals.AnnouncementSubscription); @@ -29239,22 +22131,14 @@ protocol: 'announcing', fn: function (anAnnouncement){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$4,$2,$1,$receiver; $3=$recv($Smalltalk())._globals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["globals"]=1; -//>>excludeEnd("ctx"); $4=$recv(self._announcementClass())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._at_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); if(($receiver = $2) == null || $receiver.isNil){ return false; } else { @@ -29263,15 +22147,11 @@ class_=$receiver; $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"] }), $globals.AnnouncementSubscription); @@ -29282,21 +22162,15 @@ selector: "receiver", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._valuable())._receiver(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ self valuable receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["receiver", "valuable"] }), $globals.AnnouncementSubscription); @@ -29312,11 +22186,9 @@ $1=self["@valuable"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "valuable\x0a\x09^ valuable", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementSubscription); @@ -29331,11 +22203,9 @@ self["@valuable"]=aValuable; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aValuable"], source: "valuable: aValuable\x0a\x09valuable := aValuable", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementSubscription); @@ -29343,9 +22213,7 @@ $globals.AnnouncementSubscription); $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "receiver", @@ -29357,11 +22225,9 @@ $1=self["@receiver"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "receiver\x0a\x09^ receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementValuable); @@ -29376,11 +22242,9 @@ self["@receiver"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "receiver: anObject\x0a\x09receiver := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementValuable); @@ -29396,11 +22260,9 @@ $1=self["@valuable"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "valuable\x0a\x09^ valuable", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementValuable); @@ -29415,11 +22277,9 @@ self["@valuable"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "valuable: anObject\x0a\x09valuable := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AnnouncementValuable); @@ -29430,21 +22290,15 @@ selector: "value", protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._valuable())._value(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "value\x0a\x09^ self valuable value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value", "valuable"] }), $globals.AnnouncementValuable); @@ -29455,21 +22309,15 @@ selector: "value:", protocol: 'evaluating', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._valuable())._value_(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "value: anObject\x0a\x09^ self valuable value: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:", "valuable"] }), $globals.AnnouncementValuable); @@ -29477,37 +22325,25 @@ $globals.AnnouncementValuable); $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ]."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "announce:", protocol: 'announcing', fn: function (anAnnouncement){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@subscriptions"])._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._deliver_(anAnnouncement); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anAnnouncement"], source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "deliver:"] }), $globals.Announcer); @@ -29519,28 +22355,18 @@ protocol: 'initialization', fn: function (){ var self=this; function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@subscriptions"]=$recv($OrderedCollection())._new(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new", referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); messageSends: ["initialize", "new"] }), $globals.Announcer); @@ -29551,20 +22377,14 @@ selector: "on:do:", protocol: 'subscribing', fn: function (aClass,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._on_do_for_(aClass,aBlock,nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aBlock"], source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["on:do:for:"] }), $globals.Announcer); @@ -29577,42 +22397,30 @@ fn: function (aClass,aBlock,aReceiver){ var self=this; function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$4,$6,$7,$5,$8,$2; $1=self["@subscriptions"]; $3=$recv($AnnouncementSubscription())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); $4=$3; $6=$recv($AnnouncementValuable())._new(); $recv($6)._valuable_(aBlock); $recv($6)._receiver_(aReceiver); $7=$recv($6)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); $5=$7; $recv($4)._valuable_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["valuable:"]=1; -//>>excludeEnd("ctx"); $recv($3)._announcementClass_(aClass); $8=$recv($3)._yourself(); $2=$8; $recv($1)._add_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aBlock", "aReceiver"], source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)", referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"], -//>>excludeEnd("ide"); messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"] }), $globals.Announcer); @@ -29625,35 +22433,25 @@ fn: function (aClass,aBlock){ var self=this; var subscription; function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv($AnnouncementSubscription())._new(); $recv($1)._announcementClass_(aClass); $2=$recv($1)._yourself(); subscription=$2; $recv(subscription)._valuable_((function(ann){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $recv(self["@subscriptions"])._remove_(subscription); return $recv(aBlock)._value_(ann); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $recv(self["@subscriptions"])._add_(subscription); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aBlock"], source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription", referencedClasses: ["AnnouncementSubscription"], -//>>excludeEnd("ide"); messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"] }), $globals.Announcer); @@ -29666,23 +22464,17 @@ fn: function (aClass,aSelector,anObject){ var self=this; function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$4,$6,$7,$5,$8,$2; $1=self["@subscriptions"]; $3=$recv($AnnouncementSubscription())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); $4=$3; $6=$recv($MessageSend())._new(); $recv($6)._receiver_(anObject); $recv($6)._selector_(aSelector); $7=$recv($6)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); $5=$7; $recv($4)._valuable_($5); $recv($3)._announcementClass_(aClass); @@ -29690,15 +22482,11 @@ $8=$recv($3)._yourself(); $2=$8; $recv($1)._add_($2); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aSelector", "anObject"], source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)", referencedClasses: ["AnnouncementSubscription", "MessageSend"], -//>>excludeEnd("ide"); messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"] }), $globals.Announcer); @@ -29709,28 +22497,18 @@ selector: "unsubscribe:", protocol: 'subscribing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._receiver()).__eq(anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["reject:", "=", "receiver"] }), $globals.Announcer); @@ -29738,9 +22516,7 @@ $globals.Announcer); $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`"; -//>>excludeEnd("ide"); $globals.SystemAnnouncer.klass.iVarNames = ['current']; $core.addMethod( @@ -29749,34 +22525,24 @@ selector: "current", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@current"]; if(($receiver = $2) == null || $receiver.isNil){ self["@current"]=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; $1=self["@current"]; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "current\x0a\x09^ current ifNil: [ current := super new ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.SystemAnnouncer.klass); @@ -29787,29 +22553,21 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._shouldNotImplement(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09self shouldNotImplement", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["shouldNotImplement"] }), $globals.SystemAnnouncer.klass); $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.SystemAnnouncement.comment="I am the superclass of all system announcements"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -29820,20 +22578,16 @@ var self=this; return "announcement"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'announcement'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SystemAnnouncement.klass); $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "theClass", @@ -29845,11 +22599,9 @@ $1=self["@theClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theClass\x0a\x09^ theClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassAnnouncement); @@ -29864,11 +22616,9 @@ self["@theClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassAnnouncement); @@ -29876,27 +22626,19 @@ $globals.ClassAnnouncement); $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"; -//>>excludeEnd("ide"); $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"; -//>>excludeEnd("ide"); $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"; -//>>excludeEnd("ide"); $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassMigrated.comment="I am emitted when a class is migrated."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "oldClass", @@ -29908,11 +22650,9 @@ $1=self["@oldClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "oldClass\x0a\x09^ oldClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassMigrated); @@ -29927,11 +22667,9 @@ self["@oldClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "oldClass: aClass\x0a\x09oldClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassMigrated); @@ -29939,9 +22677,7 @@ $globals.ClassMigrated); $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "oldPackage", @@ -29953,11 +22689,9 @@ $1=self["@oldPackage"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "oldPackage\x0a\x09^ oldPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassMoved); @@ -29972,11 +22706,9 @@ self["@oldPackage"]=aPackage; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackage"], source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ClassMoved); @@ -29984,21 +22716,15 @@ $globals.ClassMoved); $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"; -//>>excludeEnd("ide"); $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"; -//>>excludeEnd("ide"); $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "method", @@ -30010,11 +22736,9 @@ $1=self["@method"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "method\x0a\x09^ method", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodAnnouncement); @@ -30029,11 +22753,9 @@ self["@method"]=aCompiledMethod; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCompiledMethod"], source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodAnnouncement); @@ -30041,15 +22763,11 @@ $globals.MethodAnnouncement); $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class."; -//>>excludeEnd("ide"); $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "oldMethod", @@ -30061,11 +22779,9 @@ $1=self["@oldMethod"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "oldMethod\x0a\x09^ oldMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodModified); @@ -30080,11 +22796,9 @@ self["@oldMethod"]=aMethod; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodModified); @@ -30092,9 +22806,7 @@ $globals.MethodModified); $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "oldProtocol", @@ -30106,11 +22818,9 @@ $1=self["@oldProtocol"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "oldProtocol\x0a\x09^ oldProtocol", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodMoved); @@ -30125,11 +22835,9 @@ self["@oldProtocol"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "oldProtocol: aString\x0a\x09oldProtocol := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.MethodMoved); @@ -30137,15 +22845,11 @@ $globals.MethodMoved); $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class."; -//>>excludeEnd("ide"); $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "package", @@ -30157,11 +22861,9 @@ $1=self["@package"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "package\x0a\x09^ package", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.PackageAnnouncement); @@ -30176,11 +22878,9 @@ self["@package"]=aPackage; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackage"], source: "package: aPackage\x0a\x09package := aPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.PackageAnnouncement); @@ -30188,42 +22888,30 @@ $globals.PackageAnnouncement); $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system."; -//>>excludeEnd("ide"); $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean."; -//>>excludeEnd("ide"); $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageDirty.comment="I am emitted when a package becomes dirty."; -//>>excludeEnd("ide"); $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system."; -//>>excludeEnd("ide"); $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "package", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self._theClass(); if(($receiver = $2) == null || $receiver.isNil){ @@ -30234,15 +22922,11 @@ class_=$receiver; $1=$recv(class_)._packageOfProtocol_(self._protocol()); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"] }), $globals.ProtocolAnnouncement); @@ -30258,11 +22942,9 @@ $1=self["@protocol"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "protocol\x0a\x09^ protocol", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtocolAnnouncement); @@ -30277,11 +22959,9 @@ self["@protocol"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "protocol: aString\x0a\x09protocol := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtocolAnnouncement); @@ -30297,11 +22977,9 @@ $1=self["@theClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theClass\x0a\x09^ theClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtocolAnnouncement); @@ -30316,11 +22994,9 @@ self["@theClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ProtocolAnnouncement); @@ -30328,42 +23004,32 @@ $globals.ProtocolAnnouncement); $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class."; -//>>excludeEnd("ide"); $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class."; -//>>excludeEnd("ide"); }); -define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){ +define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){ var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage('Platform-Services'); $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); }; $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "handleError:", protocol: 'error handling', fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=$recv(anError)._context(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["context"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { @@ -30371,15 +23037,11 @@ self._logErrorContext_($recv(anError)._context()); }; self._logError_(anError); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anError"], source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"] }), $globals.ConsoleErrorHandler); @@ -30390,20 +23052,14 @@ selector: "log:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(console)._log_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "log: aString\x0a\x09console log: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["log:"] }), $globals.ConsoleErrorHandler); @@ -30414,14 +23070,10 @@ selector: "logContext:", protocol: 'private', fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=$recv(aContext)._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { @@ -30429,15 +23081,11 @@ self._logContext_($recv(aContext)._home()); }; self._log_($recv(aContext)._asString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aContext"], source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"] }), $globals.ConsoleErrorHandler); @@ -30448,20 +23096,14 @@ selector: "logError:", protocol: 'private', fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._log_($recv(anError)._messageText()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anError"], source: "logError: anError\x0a\x09self log: anError messageText", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["log:", "messageText"] }), $globals.ConsoleErrorHandler); @@ -30472,17 +23114,13 @@ selector: "logErrorContext:", protocol: 'private', fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; if(($receiver = aContext) == null || $receiver.isNil){ aContext; } else { $1=$recv(aContext)._home(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["home"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { @@ -30490,15 +23128,11 @@ self._logContext_($recv(aContext)._home()); }; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aContext"], source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "home", "logContext:"] }), $globals.ConsoleErrorHandler); @@ -30512,29 +23146,21 @@ protocol: 'initialization', fn: function (){ var self=this; function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($ErrorHandler())._registerIfNone_(self._new()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09ErrorHandler registerIfNone: self new", referencedClasses: ["ErrorHandler"], -//>>excludeEnd("ide"); messageSends: ["registerIfNone:", "new"] }), $globals.ConsoleErrorHandler.klass); $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "clear", @@ -30544,11 +23170,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "clear\x0a\x09\x22no op\x22", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ConsoleTranscript); @@ -30562,11 +23186,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "cr\x0a\x09\x22no op\x22", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ConsoleTranscript); @@ -30580,11 +23202,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "open", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ConsoleTranscript); @@ -30595,20 +23215,14 @@ selector: "show:", protocol: 'printing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); console.log(String($recv(anObject)._asString())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.ConsoleTranscript); @@ -30621,29 +23235,21 @@ protocol: 'initialization', fn: function (){ var self=this; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Transcript())._registerIfNone_(self._new()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09Transcript registerIfNone: self new", referencedClasses: ["Transcript"], -//>>excludeEnd("ide"); messageSends: ["registerIfNone:", "new"] }), $globals.ConsoleTranscript.klass); $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "ajax:", @@ -30651,22 +23257,17 @@ protocol: 'actions', fn: function (anObject){ var self=this; function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; +self._deprecatedAPI(); $1=$recv($PlatformInterface())._ajax_(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], -source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject", +source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject", referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); -messageSends: ["ajax:"] +messageSends: ["deprecatedAPI", "ajax:"] }), $globals.InterfacingObject); @@ -30676,22 +23277,16 @@ selector: "alert:", protocol: 'actions', fn: function (aString){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($PlatformInterface())._alert_(aString); +$1=$recv($Terminal())._alert_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "alert: aString\x0a\x09^ PlatformInterface alert: aString", -referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); +source: "alert: aString\x0a\x09^ Terminal alert: aString", +referencedClasses: ["Terminal"], messageSends: ["alert:"] }), $globals.InterfacingObject); @@ -30702,22 +23297,16 @@ selector: "confirm:", protocol: 'actions', fn: function (aString){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($PlatformInterface())._confirm_(aString); +$1=$recv($Terminal())._confirm_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString", -referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); +source: "confirm: aString\x0a\x09^ Terminal confirm: aString", +referencedClasses: ["Terminal"], messageSends: ["confirm:"] }), $globals.InterfacingObject); @@ -30728,22 +23317,16 @@ selector: "prompt:", protocol: 'actions', fn: function (aString){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($PlatformInterface())._prompt_(aString); +$1=$recv($Terminal())._prompt_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString", -referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); +source: "prompt: aString\x0a\x09^ Terminal prompt: aString", +referencedClasses: ["Terminal"], messageSends: ["prompt:"] }), $globals.InterfacingObject); @@ -30754,22 +23337,16 @@ selector: "prompt:default:", protocol: 'actions', fn: function (aString,defaultString){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($PlatformInterface())._prompt_default_(aString,defaultString); +$1=$recv($Terminal())._prompt_default_(aString,defaultString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "defaultString"], -source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString", -referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); +source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString", +referencedClasses: ["Terminal"], messageSends: ["prompt:default:"] }), $globals.InterfacingObject); @@ -30777,39 +23354,29 @@ $globals.InterfacingObject); $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addInstVarNamed:to:", protocol: 'compiling', fn: function (aString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5; $1=self._classBuilder(); $2=$recv(aClass)._superclass(); $3=$recv(aClass)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $4=$recv($recv(aClass)._instanceVariableNames())._copy(); $recv($4)._add_(aString); $5=$recv($4)._yourself(); $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aClass"], source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"] }), $globals.Environment); @@ -30821,21 +23388,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Smalltalk())._core())._allSelectors(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allSelectors\x0a\x09^ Smalltalk core allSelectors", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["allSelectors", "core"] }), $globals.Environment); @@ -30847,29 +23408,19 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["collect:", "classes", "name"] }), $globals.Environment); @@ -30881,29 +23432,19 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["collect:", "packages", "name"] }), $globals.Environment); @@ -30915,15 +23456,11 @@ protocol: 'accessing', fn: function (aClass){ var self=this; var protocols; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; protocols=$recv(aClass)._protocols(); $1=$recv(aClass)._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { @@ -30931,15 +23468,11 @@ $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass }; $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort(); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"] }), $globals.Environment); @@ -30951,21 +23484,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($ClassBuilder())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classBuilder\x0a\x09^ ClassBuilder new", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["new"] }), $globals.Environment); @@ -30977,9 +23504,7 @@ protocol: 'accessing', fn: function (aString){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol()); if(($receiver = $2) == null || $receiver.isNil){ @@ -30988,15 +23513,11 @@ $1=self._error_("Invalid class name"); $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"] }), $globals.Environment); @@ -31008,21 +23529,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Smalltalk())._classes(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classes\x0a\x09^ Smalltalk classes", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["classes"] }), $globals.Environment); @@ -31033,20 +23548,14 @@ selector: "commitPackage:onSuccess:onError:", protocol: 'actions', fn: function (aPackage,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPackage", "aBlock", "anotherBlock"], source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["commitOnSuccess:onError:", "transport"] }), $globals.Environment); @@ -31057,20 +23566,14 @@ selector: "compileClassComment:for:", protocol: 'compiling', fn: function (aString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aClass)._comment_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aClass"], source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["comment:"] }), $globals.Environment); @@ -31083,36 +23586,22 @@ fn: function (aString){ var self=this; function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._evaluate_for_(aString,$recv($DoIt())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }))._on_do_($Error(),(function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._alert_($recv(error)._messageText()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]", referencedClasses: ["DoIt", "Error"], -//>>excludeEnd("ide"); messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"] }), $globals.Environment); @@ -31123,21 +23612,15 @@ selector: "compileMethod:for:protocol:", protocol: 'compiling', fn: function (sourceCode,class_,protocol){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(class_)._compile_protocol_(sourceCode,protocol); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["sourceCode", "class", "protocol"], source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["compile:protocol:"] }), $globals.Environment); @@ -31150,31 +23633,23 @@ fn: function (aClass,aClassName){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; $1=$recv($recv($Smalltalk())._globals())._at_(aClassName); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); self._error_($2); }; $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aClassName"], source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName", referencedClasses: ["Smalltalk", "ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"] }), $globals.Environment); @@ -31186,21 +23661,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($DoIt())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "doItReceiver\x0a\x09^ DoIt new", referencedClasses: ["DoIt"], -//>>excludeEnd("ide"); messageSends: ["new"] }), $globals.Environment); @@ -31212,21 +23681,15 @@ protocol: 'evaluating', fn: function (aString,anObject){ var self=this; function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Evaluator())._evaluate_for_(aString,anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject", referencedClasses: ["Evaluator"], -//>>excludeEnd("ide"); messageSends: ["evaluate:for:"] }), $globals.Environment); @@ -31237,34 +23700,24 @@ selector: "evaluate:on:do:", protocol: 'error handling', fn: function (aBlock,anErrorClass,exceptionBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aBlock)._tryCatch_((function(exception){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name())); if($core.assert($1)){ return $recv(exceptionBlock)._value_(exception); } else { return $recv(exception)._resignal(); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "anErrorClass", "exceptionBlock"], source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"] }), $globals.Environment); @@ -31276,20 +23729,14 @@ protocol: 'actions', fn: function (anObject){ var self=this; function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Inspector())._inspect_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "inspect: anObject\x0a\x09Inspector inspect: anObject", referencedClasses: ["Inspector"], -//>>excludeEnd("ide"); messageSends: ["inspect:"] }), $globals.Environment); @@ -31302,9 +23749,7 @@ fn: function (aClass,aPackageName){ var self=this; var package_; function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; package_=$recv($Package())._named_(aPackageName); $1=package_; @@ -31319,15 +23764,11 @@ return self; }; $recv(aClass)._package_(package_); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aPackageName"], source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package", referencedClasses: ["Package"], -//>>excludeEnd("ide"); messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"] }), $globals.Environment); @@ -31339,24 +23780,18 @@ protocol: 'actions', fn: function (aMethod,aClassName){ var self=this; var destinationClass; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1,$5,$4; destinationClass=self._classNamed_(aClassName); $2=destinationClass; $3=$recv(aMethod)._methodClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodClass"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__eq_eq($3); if($core.assert($1)){ return self; }; $5=$recv(aMethod)._methodClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["methodClass"]=2; -//>>excludeEnd("ctx"); $4=$recv($5)._isMetaclass(); if($core.assert($4)){ destinationClass=$recv(destinationClass)._class(); @@ -31365,15 +23800,11 @@ destinationClass; $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol()); $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod", "aClassName"], source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"] }), $globals.Environment); @@ -31384,20 +23815,14 @@ selector: "moveMethod:toProtocol:", protocol: 'actions', fn: function (aMethod,aProtocol){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aMethod)._protocol_(aProtocol); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod", "aProtocol"], source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["protocol:"] }), $globals.Environment); @@ -31409,21 +23834,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($Smalltalk())._packages(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "packages\x0a\x09^ Smalltalk packages", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["packages"] }), $globals.Environment); @@ -31435,20 +23854,14 @@ protocol: 'services', fn: function (anErrorHandler){ var self=this; function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($ErrorHandler())._register_(anErrorHandler); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anErrorHandler"], source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler", referencedClasses: ["ErrorHandler"], -//>>excludeEnd("ide"); messageSends: ["register:"] }), $globals.Environment); @@ -31460,20 +23873,14 @@ protocol: 'services', fn: function (aFinder){ var self=this; function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Finder())._register_(aFinder); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aFinder"], source: "registerFinder: aFinder\x0a\x09Finder register: aFinder", referencedClasses: ["Finder"], -//>>excludeEnd("ide"); messageSends: ["register:"] }), $globals.Environment); @@ -31485,20 +23892,14 @@ protocol: 'services', fn: function (anInspector){ var self=this; function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Inspector())._register_(anInspector); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInspector"], source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector", referencedClasses: ["Inspector"], -//>>excludeEnd("ide"); messageSends: ["register:"] }), $globals.Environment); @@ -31510,20 +23911,14 @@ protocol: 'services', fn: function (aProgressHandler){ var self=this; function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($ProgressHandler())._register_(aProgressHandler); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aProgressHandler"], source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler", referencedClasses: ["ProgressHandler"], -//>>excludeEnd("ide"); messageSends: ["register:"] }), $globals.Environment); @@ -31535,20 +23930,14 @@ protocol: 'services', fn: function (aTranscript){ var self=this; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Transcript())._register_(aTranscript); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aTranscript"], source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript", referencedClasses: ["Transcript"], -//>>excludeEnd("ide"); messageSends: ["register:"] }), $globals.Environment); @@ -31560,20 +23949,14 @@ protocol: 'actions', fn: function (aClass){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Smalltalk())._removeClass_(aClass); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["removeClass:"] }), $globals.Environment); @@ -31584,20 +23967,14 @@ selector: "removeMethod:", protocol: 'actions', fn: function (aMethod){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMethod"], source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["removeCompiledMethod:", "methodClass"] }), $globals.Environment); @@ -31608,28 +23985,18 @@ selector: "removeProtocol:from:", protocol: 'actions', fn: function (aString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(aClass)._removeCompiledMethod_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aClass"], source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"] }), $globals.Environment); @@ -31642,63 +24009,73 @@ fn: function (aClass,aClassName){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; $1=$recv($recv($Smalltalk())._globals())._at_(aClassName); if(($receiver = $1) == null || $receiver.isNil){ $1; } else { $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); self._error_($2); }; $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aClassName"], source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName", referencedClasses: ["Smalltalk", "ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"] }), $globals.Environment); +$core.addMethod( +$core.method({ +selector: "renamePackage:to:", +protocol: 'actions', +fn: function (aPackageName,aNewPackageName){ +var self=this; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $1,$2,$receiver; +$1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName); +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +$2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists"); +$ctx1.sendIdx[","]=1; +self._error_($2); +}; +$recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName); +return self; +}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)}); +}, +args: ["aPackageName", "aNewPackageName"], +source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName", +referencedClasses: ["Smalltalk"], +messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"] +}), +$globals.Environment); + $core.addMethod( $core.method({ selector: "renameProtocol:to:in:", protocol: 'actions', fn: function (aString,anotherString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._protocol_(anotherString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString", "aClass"], source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "methodsInProtocol:", "protocol:"] }), $globals.Environment); @@ -31709,20 +24086,14 @@ selector: "setClassCommentOf:to:", protocol: 'actions', fn: function (aClass,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aClass)._comment_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aString"], source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["comment:"] }), $globals.Environment); @@ -31734,21 +24105,15 @@ protocol: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current", referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["current", "at:", "globals"] }), $globals.Environment); @@ -31756,29 +24121,21 @@ $globals.Environment); $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "do:on:displaying:", protocol: 'progress handling', fn: function (aBlock,aCollection,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aCollection)._do_(aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "aCollection", "aString"], source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:"] }), $globals.NullProgressHandler); @@ -31792,58 +24149,44 @@ protocol: 'initialization', fn: function (){ var self=this; function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($ProgressHandler())._registerIfNone_(self._new()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09ProgressHandler registerIfNone: self new", referencedClasses: ["ProgressHandler"], -//>>excludeEnd("ide"); messageSends: ["registerIfNone:", "new"] }), $globals.NullProgressHandler.klass); $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }."; -//>>excludeEnd("ide"); +$globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`."; -$globals.PlatformInterface.klass.iVarNames = ['worker']; $core.addMethod( $core.method({ selector: "ajax:", protocol: 'actions', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@worker"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("ajax: not available"); +var $1,$receiver; +self._deprecatedAPI_("Use Platform newXhr or dedicated library."); +if(($receiver = $JQuery()) == null || $receiver.isNil){ +$1=self._error_("JQuery wrapper not loaded, cannot do AJAX."); } else { -$1=$recv(self["@worker"])._ajax_(anObject); +$1=$recv($recv($JQuery())._current())._ajax_(anObject); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], -source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"] +source: "ajax: anObject\x0a\x09self deprecatedAPI: 'Use Platform newXhr or dedicated library.'.\x0a\x09^ JQuery\x0a\x09\x09ifNotNil: [ JQuery current ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ]", +referencedClasses: ["JQuery"], +messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"] }), $globals.PlatformInterface.klass); @@ -31853,27 +24196,18 @@ selector: "alert:", protocol: 'actions', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@worker"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("alert: not available"); -} else { -$1=$recv(self["@worker"])._alert_(aString); -}; +var $1; +self._deprecatedAPI_("Use Terminal alert:"); +$1=$recv($Terminal())._alert_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:ifNil:", "alert:", "error:"] +source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString", +referencedClasses: ["Terminal"], +messageSends: ["deprecatedAPI:", "alert:"] }), $globals.PlatformInterface.klass); @@ -31883,27 +24217,18 @@ selector: "confirm:", protocol: 'actions', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@worker"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("confirm: not available"); -} else { -$1=$recv(self["@worker"])._confirm_(aString); -}; +var $1; +self._deprecatedAPI_("Use Terminal confirm:"); +$1=$recv($Terminal())._confirm_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"] +source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString", +referencedClasses: ["Terminal"], +messageSends: ["deprecatedAPI:", "confirm:"] }), $globals.PlatformInterface.klass); @@ -31914,10 +24239,9 @@ protocol: 'actions', fn: function (aString){ var self=this; function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; +self._deprecatedAPI_("Use Smalltalk existsJsGlobal:"); $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){ return true; @@ -31926,16 +24250,12 @@ return false; })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]", +source: "existsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Smalltalk existsJsGlobal:'.\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]", referencedClasses: ["PlatformInterface"], -//>>excludeEnd("ide"); -messageSends: ["at:ifPresent:ifAbsent:", "globals"] +messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"] }), $globals.PlatformInterface.klass); @@ -31945,66 +24265,39 @@ selector: "globals", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return (new Function('return this'))();; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +self._deprecatedAPI_("Use Platform globals"); +$1=$recv($Platform())._globals(); +return $1; }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "globals\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals", +referencedClasses: ["Platform"], +messageSends: ["deprecatedAPI:", "globals"] }), $globals.PlatformInterface.klass); $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', +selector: "newXhr", +protocol: 'actions', fn: function (){ var self=this; -var candidate; -function $BrowserInterface(){return $globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -if(($receiver = $BrowserInterface()) == null || $receiver.isNil){ -$BrowserInterface(); -} else { -candidate=$recv($BrowserInterface())._new(); -candidate; -$1=$recv(candidate)._isAvailable(); -if($core.assert($1)){ -self._setWorker_(candidate); -return self; -}; -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); +var $1; +self._deprecatedAPI_("Use Platform newXhr"); +$1=$recv($Platform())._newXhr(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]", -referencedClasses: ["BrowserInterface"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"] +source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr", +referencedClasses: ["Platform"], +messageSends: ["deprecatedAPI:", "newXhr"] }), $globals.PlatformInterface.klass); @@ -32014,27 +24307,18 @@ selector: "prompt:", protocol: 'actions', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@worker"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("prompt: not available"); -} else { -$1=$recv(self["@worker"])._prompt_(aString); -}; +var $1; +self._deprecatedAPI_("Use Terminal prompt:"); +$1=$recv($Terminal())._prompt_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"] +source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString", +referencedClasses: ["Terminal"], +messageSends: ["deprecatedAPI:", "prompt:"] }), $globals.PlatformInterface.klass); @@ -32044,54 +24328,24 @@ selector: "prompt:default:", protocol: 'actions', fn: function (aString,defaultString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@worker"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("prompt: not available"); -} else { -$1=$recv(self["@worker"])._prompt_default_(aString,defaultString); -}; +var $1; +self._deprecatedAPI_("Use Terminal prompt:default:"); +$1=$recv($Terminal())._prompt_default_(aString,defaultString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "defaultString"], -source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"] -}), -$globals.PlatformInterface.klass); - -$core.addMethod( -$core.method({ -selector: "setWorker:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -self["@worker"]=anObject; -return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "setWorker: anObject\x0a\x09worker := anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString", +referencedClasses: ["Terminal"], +messageSends: ["deprecatedAPI:", "prompt:default:"] }), $globals.PlatformInterface.klass); $core.addClass('Service', $globals.Object, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service."; -//>>excludeEnd("ide"); $globals.Service.klass.iVarNames = ['current']; $core.addMethod( @@ -32105,11 +24359,9 @@ $1=self["@current"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "current\x0a\x09^ current", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Service.klass); @@ -32120,20 +24372,14 @@ selector: "new", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._shouldNotImplement(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "new\x0a\x09self shouldNotImplement", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["shouldNotImplement"] }), $globals.Service.klass); @@ -32148,11 +24394,9 @@ self["@current"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "register: anObject\x0a\x09current := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Service.klass); @@ -32163,9 +24407,7 @@ selector: "registerIfNone:", protocol: 'registration', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$receiver; $1=self._current(); if(($receiver = $1) == null || $receiver.isNil){ @@ -32174,24 +24416,18 @@ self._register_(anObject); $1; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "current", "register:"] }), $globals.Service.klass); $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -32199,20 +24435,14 @@ selector: "handleError:", protocol: 'error handling', fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._handleUnhandledError_(anError); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anError"], source: "handleError: anError\x0a\x09self handleUnhandledError: anError", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["handleUnhandledError:"] }), $globals.ErrorHandler.klass); @@ -32223,9 +24453,7 @@ selector: "handleUnhandledError:", protocol: 'error handling', fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv(anError)._wasHandled(); if($core.assert($1)){ @@ -32233,24 +24461,18 @@ return self; }; $2=$recv(self._current())._handleError_(anError); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anError"], source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"] }), $globals.ErrorHandler.klass); $core.addClass('Finder', $globals.Service, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -32258,21 +24480,15 @@ selector: "findClass:", protocol: 'finding', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._current())._findClass_(aClass); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "findClass: aClass\x0a\x09^ self current findClass: aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["findClass:", "current"] }), $globals.Finder.klass); @@ -32283,21 +24499,15 @@ selector: "findMethod:", protocol: 'finding', fn: function (aCompiledMethod){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._current())._findMethod_(aCompiledMethod); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCompiledMethod"], source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["findMethod:", "current"] }), $globals.Finder.klass); @@ -32308,30 +24518,22 @@ selector: "findString:", protocol: 'finding', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._current())._findString_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "findString: aString\x0a\x09^ self current findString: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["findString:", "current"] }), $globals.Finder.klass); $core.addClass('Inspector', $globals.Service, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -32339,30 +24541,64 @@ selector: "inspect:", protocol: 'inspecting', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._current())._inspect_(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "inspect: anObject\x0a\x09^ self current inspect: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["inspect:", "current"] }), $globals.Inspector.klass); +$core.addClass('Platform', $globals.Service, [], 'Platform-Services'); +$globals.Platform.comment="I am bridge to JS environment.\x0a\x0a## API\x0a\x0a Platform globals. \x22JS global object\x22\x0a Platform newXHR \x22new XMLHttpRequest() or its shim\x22"; + +$core.addMethod( +$core.method({ +selector: "globals", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._globals(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)}); +}, +args: [], +source: "globals\x0a\x09^ self current globals", +referencedClasses: [], +messageSends: ["globals", "current"] +}), +$globals.Platform.klass); + +$core.addMethod( +$core.method({ +selector: "newXhr", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._newXhr(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)}); +}, +args: [], +source: "newXhr\x0a\x09^ self current newXhr", +referencedClasses: [], +messageSends: ["newXhr", "current"] +}), +$globals.Platform.klass); + + $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -32370,29 +24606,101 @@ selector: "do:on:displaying:", protocol: 'progress handling', fn: function (aBlock,aCollection,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock", "aCollection", "aString"], source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:on:displaying:", "current"] }), $globals.ProgressHandler.klass); +$core.addClass('Terminal', $globals.Service, [], 'Platform-Services'); +$globals.Terminal.comment="I am UI interface service.\x0a\x0a## API\x0a\x0a Terminal alert: 'Hey, there is a problem'.\x0a Terminal confirm: 'Affirmative?'.\x0a Terminal prompt: 'Your name:'."; + +$core.addMethod( +$core.method({ +selector: "alert:", +protocol: 'dialogs', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._alert_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)}); +}, +args: ["aString"], +source: "alert: aString\x0a\x09^ self current alert: aString", +referencedClasses: [], +messageSends: ["alert:", "current"] +}), +$globals.Terminal.klass); + +$core.addMethod( +$core.method({ +selector: "confirm:", +protocol: 'dialogs', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._confirm_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)}); +}, +args: ["aString"], +source: "confirm: aString\x0a\x09^ self current confirm: aString", +referencedClasses: [], +messageSends: ["confirm:", "current"] +}), +$globals.Terminal.klass); + +$core.addMethod( +$core.method({ +selector: "prompt:", +protocol: 'dialogs', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._prompt_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)}); +}, +args: ["aString"], +source: "prompt: aString\x0a\x09^ self current prompt: aString", +referencedClasses: [], +messageSends: ["prompt:", "current"] +}), +$globals.Terminal.klass); + +$core.addMethod( +$core.method({ +selector: "prompt:default:", +protocol: 'dialogs', +fn: function (aString,defaultString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._current())._prompt_default_(aString,defaultString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)}); +}, +args: ["aString", "defaultString"], +source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString", +referencedClasses: [], +messageSends: ["prompt:default:", "current"] +}), +$globals.Terminal.klass); + + $core.addClass('Transcript', $globals.Service, [], 'Platform-Services'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -32400,20 +24708,14 @@ selector: "clear", protocol: 'printing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._clear(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "clear\x0a\x09self current clear", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["clear", "current"] }), $globals.Transcript.klass); @@ -32425,20 +24727,14 @@ protocol: 'printing', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._show_($recv($String())._cr()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "cr\x0a\x09self current show: String cr", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["show:", "current", "cr"] }), $globals.Transcript.klass); @@ -32449,20 +24745,14 @@ selector: "inspect:", protocol: 'printing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._show_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "inspect: anObject\x0a\x09self show: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["show:"] }), $globals.Transcript.klass); @@ -32473,20 +24763,14 @@ selector: "open", protocol: 'instance creation', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._open(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "open\x0a\x09self current open", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["open", "current"] }), $globals.Transcript.klass); @@ -32497,16276 +24781,10520 @@ selector: "show:", protocol: 'printing', fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._current())._show_(anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "show: anObject\x0a\x09self current show: anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["show:", "current"] }), $globals.Transcript.klass); $core.addMethod( $core.method({ -selector: "do:displayingProgress:", +selector: "inspectOn:", protocol: '*Platform-Services', -fn: function (aBlock,aString){ +fn: function (anInspector){ var self=this; -function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString); +var $1; +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +$recv(variables)._at_put_("#keys",self._keys()); +$ctx1.sendIdx["at:put:"]=2; +self._keysAndValuesDo_((function(key,value){ +return $core.withContext(function($ctx2) { +return $recv(variables)._at_put_(key,value); +}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)}); +})); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "aString"], -source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString", -referencedClasses: ["ProgressHandler"], -//>>excludeEnd("ide"); -messageSends: ["do:on:displaying:"] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"] }), -$globals.SequenceableCollection); - -}); - -define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Exceptions'); -$core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"}; - -$core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.CompilerError.comment="I am the common superclass of all compiling errors."; -//>>excludeEnd("ide"); - - -$core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`"; -//>>excludeEnd("ide"); - - -$core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling"; -//>>excludeEnd("ide"); - - -$core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`."; -//>>excludeEnd("ide"); - +$globals.AssociativeCollection); -$core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "messageText", -protocol: 'accessing', -fn: function (){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=" Invalid assignment to variable: ".__comma(self._variableName()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)}); -//>>excludeEnd("ctx"); +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +self._withIndexDo_((function(each,i){ +return $core.withContext(function($ctx2) { +return $recv(variables)._at_put_(i,each); +}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)}); +})); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "variableName"] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"] }), -$globals.InvalidAssignmentError); +$globals.Collection); $core.addMethod( $core.method({ -selector: "variableName", -protocol: 'accessing', -fn: function (){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $core.withContext(function($ctx1) { var $1; -$1=self["@variableName"]; -return $1; - +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +$recv(variables)._at_put_("#year",self._year()); +$ctx1.sendIdx["at:put:"]=2; +$recv(variables)._at_put_("#month",self._month()); +$ctx1.sendIdx["at:put:"]=3; +$recv(variables)._at_put_("#day",self._day()); +$ctx1.sendIdx["at:put:"]=4; +$recv(variables)._at_put_("#hours",self._hours()); +$ctx1.sendIdx["at:put:"]=5; +$recv(variables)._at_put_("#minutes",self._minutes()); +$ctx1.sendIdx["at:put:"]=6; +$recv(variables)._at_put_("#seconds",self._seconds()); +$ctx1.sendIdx["at:put:"]=7; +$recv(variables)._at_put_("#milliseconds",self._milliseconds()); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "variableName\x0a\x09^ variableName", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#year' put: self year.\x0a\x09variables at: '#month' put: self month.\x0a\x09variables at: '#day' put: self day.\x0a\x09variables at: '#hours' put: self hours.\x0a\x09variables at: '#minutes' put: self minutes.\x0a\x09variables at: '#seconds' put: self seconds.\x0a\x09variables at: '#milliseconds' put: self milliseconds.\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"] }), -$globals.InvalidAssignmentError); +$globals.Date); $core.addMethod( $core.method({ -selector: "variableName:", -protocol: 'accessing', -fn: function (aString){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; -self["@variableName"]=aString; +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} +return $core.withContext(function($ctx1) { +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self._jsObject()); +$recv(anInspector)._setLabel_(self._printString()); +$recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self); +$recv(anInspector)._setVariables_(variables); return self; - +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "variableName: aString\x0a\x09variableName := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables", +referencedClasses: ["Dictionary", "JSObjectProxy"], +messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"] }), -$globals.InvalidAssignmentError); - - +$globals.JSObjectProxy); -$core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "messageText", -protocol: 'accessing', -fn: function (){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)}); -//>>excludeEnd("ctx"); +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +$recv(variables)._at_put_("#home",self._home()); +$ctx1.sendIdx["at:put:"]=2; +$recv(variables)._at_put_("#receiver",self._receiver()); +$ctx1.sendIdx["at:put:"]=3; +$recv(variables)._at_put_("#selector",self._selector()); +$ctx1.sendIdx["at:put:"]=4; +$recv(variables)._at_put_("#locals",self._locals()); +$ctx1.sendIdx["at:put:"]=5; +$recv($recv(self._class())._instanceVariableNames())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(variables)._at_put_(each,self._instVarAt_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "variableName"] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"] }), -$globals.ShadowingVariableError); +$globals.MethodContext); $core.addMethod( $core.method({ -selector: "variableName", -protocol: 'accessing', -fn: function (){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; +var variables; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $core.withContext(function($ctx1) { var $1; -$1=self["@variableName"]; -return $1; - +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +$recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(variables)._at_put_(each,self._instVarAt_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "variableName\x0a\x09^ variableName", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"] }), -$globals.ShadowingVariableError); +$globals.Object); $core.addMethod( $core.method({ -selector: "variableName:", -protocol: 'accessing', -fn: function (aString){ +selector: "do:displayingProgress:", +protocol: '*Platform-Services', +fn: function (aBlock,aString){ var self=this; -self["@variableName"]=aString; +function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)} +return $core.withContext(function($ctx1) { +$recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString); return self; - +}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "variableName: aString\x0a\x09variableName := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aBlock", "aString"], +source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString", +referencedClasses: ["ProgressHandler"], +messageSends: ["do:on:displaying:"] }), -$globals.ShadowingVariableError); - - +$globals.SequenceableCollection); -$core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "messageText", -protocol: 'accessing', -fn: function (){ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var variables,i; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)}); -//>>excludeEnd("ctx"); +variables=$recv($Dictionary())._new(); +$recv(variables)._at_put_("#self",self); +$ctx1.sendIdx["at:put:"]=1; +i=(1); +self._do_((function(each){ +return $core.withContext(function($ctx2) { +$recv(variables)._at_put_(i,each); +i=$recv(i).__plus((1)); +return i; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(anInspector)._setLabel_(self._printString()); +$1=$recv(anInspector)._setVariables_(variables); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'", +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"] +}), +$globals.Set); + +$core.addMethod( +$core.method({ +selector: "inspectOn:", +protocol: '*Platform-Services', +fn: function (anInspector){ +var self=this; +var label; +return $core.withContext(function($ctx1) { +var $3,$2,$1,$5,$4; +( +$ctx1.supercall = true, +$globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector])); +$ctx1.supercall = false; +$3=self._printString(); +$ctx1.sendIdx["printString"]=1; +$2=$recv($3)._size(); +$1=$recv($2).__gt((30)); +if($core.assert($1)){ +$5=self._printString(); +$ctx1.sendIdx["printString"]=2; +$4=$recv($5)._copyFrom_to_((1),(30)); +label=$recv($4).__comma("...'"); +label; +} else { +label=self._printString(); +label; +}; +$recv(anInspector)._setLabel_(label); +return self; +}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)}); +}, +args: ["anInspector"], +source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "variableName"] +messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"] }), -$globals.UnknownVariableError); +$globals.String); + +}); + +define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Platform-Node'); +$core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node'); +$globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment."; $core.addMethod( $core.method({ -selector: "variableName", +selector: "globals", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@variableName"]; +$1=global; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "variableName\x0a\x09^ variableName", +source: "globals\x0a\x09^ global", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.UnknownVariableError); +$globals.NodePlatform); $core.addMethod( $core.method({ -selector: "variableName:", +selector: "newXhr", protocol: 'accessing', -fn: function (aString){ +fn: function (){ var self=this; -self["@variableName"]=aString; +function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)} +return $core.withContext(function($ctx1) { +var $1,$receiver; +if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){ +self._error_("XMLHttpRequest not available."); +} else { +$1=$recv($XMLHttpRequest())._new(); +return $1; +}; return self; - +}, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "variableName: aString\x0a\x09variableName := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: [], +source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]", +referencedClasses: ["XMLHttpRequest"], +messageSends: ["ifNotNil:ifNil:", "new", "error:"] }), -$globals.UnknownVariableError); +$globals.NodePlatform); - -$core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "basicSignal:", -protocol: 'error handling', -fn: function (anError){ +selector: "initialize", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -throw anError; +var $1; +$1=self._isFeasible(); +if($core.assert($1)){ +$recv($Platform())._registerIfNone_(self._new()); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anError"], -source: "basicSignal: anError\x0a ", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: [], +source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]", +referencedClasses: ["Platform"], +messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"] }), -$globals.RethrowErrorHandler); +$globals.NodePlatform.klass); $core.addMethod( $core.method({ -selector: "handleError:", -protocol: 'error handling', -fn: function (anError){ +selector: "isFeasible", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._basicSignal_(anError); +return typeof global !== "undefined"; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anError"], -source: "handleError: anError\x0a self basicSignal: anError", +args: [], +source: "isFeasible\x0a", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["basicSignal:"] +messageSends: [] }), -$globals.RethrowErrorHandler); - +$globals.NodePlatform.klass); }); -define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Core'); -$core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"}; - -$core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "classNameFor:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$1; -$2=$recv(aClass)._isMetaclass(); -if($core.assert($2)){ -$3=$recv($recv(aClass)._instanceClass())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); -$1=$recv($3).__comma(".klass"); -} else { -$4=$recv(aClass)._isNil(); -if($core.assert($4)){ -$1="nil"; -} else { -$1=$recv(aClass)._name(); -}; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"] -}), -$globals.AbstractCodeGenerator); +define('amber/deploy',[ + './helpers', + // --- packages of the core Amber begin here --- + 'amber_core/Kernel-Objects', + 'amber_core/Kernel-Classes', + 'amber_core/Kernel-Methods', + 'amber_core/Kernel-Collections', + 'amber_core/Kernel-Infrastructure', + 'amber_core/Kernel-Exceptions', + 'amber_core/Kernel-Announcements', + 'amber_core/Platform-Services', + 'amber_core/Platform-Browser' + // --- packages of the core Amber end here --- +], function (amber) { return amber; }); -$core.addMethod( -$core.method({ -selector: "compileNode:", -protocol: 'compiling', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "compileNode: aNode\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] -}), -$globals.AbstractCodeGenerator); +define("amber/parser", ["./boot"], function($boot) { +var $globals = $boot.globals, nil = $boot.nil; +$globals.SmalltalkParser = (function() { + /* + * Generated by PEG.js 0.8.0. + * + * http://pegjs.majda.cz/ + */ -$core.addMethod( -$core.method({ -selector: "currentClass", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@currentClass"]; -return $1; + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "currentClass\x0a\x09^ currentClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AbstractCodeGenerator); + function SyntaxError(message, expected, found, offset, line, column) { + this.message = message; + this.expected = expected; + this.found = found; + this.offset = offset; + this.line = line; + this.column = column; -$core.addMethod( -$core.method({ -selector: "currentClass:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -self["@currentClass"]=aClass; -return self; + this.name = "SyntaxError"; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "currentClass: aClass\x0a\x09currentClass := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AbstractCodeGenerator); + peg$subclass(SyntaxError, Error); -$core.addMethod( -$core.method({ -selector: "currentPackage", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@currentPackage"]; -return $1; + function parse(input) { + var options = arguments.length > 1 ? arguments[1] : {}, -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "currentPackage\x0a\x09^ currentPackage", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AbstractCodeGenerator); + peg$FAILED = {}, -$core.addMethod( -$core.method({ -selector: "currentPackage:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -self["@currentPackage"]=anObject; -return self; + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "currentPackage: anObject\x0a\x09currentPackage := anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AbstractCodeGenerator); + peg$c0 = [], + peg$c1 = peg$FAILED, + peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/, + peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" }, + peg$c4 = "\"", + peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c6 = /^[^"]/, + peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" }, + peg$c8 = /^[a-zA-Z]/, + peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" }, + peg$c10 = /^[a-zA-Z0-9]/, + peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" }, + peg$c12 = function(first, others) {return first + others.join("");}, + peg$c13 = ":", + peg$c14 = { type: "literal", value: ":", description: "\":\"" }, + peg$c15 = function(first, last) {return first + last;}, + peg$c16 = /^[a-zA-Z0-9:]/, + peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" }, + peg$c18 = /^[A-Z]/, + peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" }, + peg$c20 = "'", + peg$c21 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c22 = "''", + peg$c23 = { type: "literal", value: "''", description: "\"''\"" }, + peg$c24 = function() {return "'";}, + peg$c25 = /^[^']/, + peg$c26 = { type: "class", value: "[^']", description: "[^']" }, + peg$c27 = function(val) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(val.join("")); + }, + peg$c28 = "$", + peg$c29 = { type: "literal", value: "$", description: "\"$\"" }, + peg$c30 = { type: "any", description: "any character" }, + peg$c31 = function(char) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(char); + }, + peg$c32 = "#", + peg$c33 = { type: "literal", value: "#", description: "\"#\"" }, + peg$c34 = function(rest) {return rest;}, + peg$c35 = function(node) {return node._value();}, + peg$c36 = function(val) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(val); + }, + peg$c37 = function(n) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(n); + }, + peg$c38 = "e", + peg$c39 = { type: "literal", value: "e", description: "\"e\"" }, + peg$c40 = function(n) {return parseFloat(n.join(""));}, + peg$c41 = null, + peg$c42 = "-", + peg$c43 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c44 = "16r", + peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" }, + peg$c46 = /^[0-9a-fA-F]/, + peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" }, + peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);}, + peg$c49 = /^[0-9]/, + peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c51 = ".", + peg$c52 = { type: "literal", value: ".", description: "\".\"" }, + peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);}, + peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));}, + peg$c55 = "#(", + peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" }, + peg$c57 = "(", + peg$c58 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c59 = function(lit) {return lit._value();}, + peg$c60 = ")", + peg$c61 = { type: "literal", value: ")", description: "\")\"" }, + peg$c62 = function(lits) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(lits); + }, + peg$c63 = "{", + peg$c64 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c65 = "}", + peg$c66 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c67 = function(expressions) { + return $globals.DynamicArrayNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._nodes_(expressions || []); + }, + peg$c68 = "#{", + peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" }, + peg$c70 = function(expressions) { + return $globals.DynamicDictionaryNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._nodes_(expressions || []); + }, + peg$c71 = "true", + peg$c72 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c73 = function() {return true;}, + peg$c74 = "false", + peg$c75 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c76 = function() {return false;}, + peg$c77 = "nil", + peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" }, + peg$c79 = function() {return nil;}, + peg$c80 = function(val) { + return $globals.ValueNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(val); + }, + peg$c81 = function(identifier) { + return $globals.VariableNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._value_(identifier); + }, + peg$c82 = function(key, arg) {return {key:key, arg:arg};}, + peg$c83 = /^[\\+*\/=><,@%~|&\-]/, + peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" }, + peg$c85 = function(bin) {return bin.join("");}, + peg$c86 = function(pairs) { + var keywords = []; + var params = []; + var i = 0; + for(i = 0; i < pairs.length; i++){ + keywords.push(pairs[i].key); + } + for(i = 0; i < pairs.length; i++){ + params.push(pairs[i].arg); + } + return [keywords.join(""), params]; + }, + peg$c87 = function(selector, arg) {return [selector, [arg]];}, + peg$c88 = function(selector) {return [selector, []];}, + peg$c89 = function(expression) {return expression;}, + peg$c90 = function(first, others) { return [first].concat(others); }, + peg$c91 = ":=", + peg$c92 = { type: "literal", value: ":=", description: "\":=\"" }, + peg$c93 = function(variable, expression) { + return $globals.AssignmentNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._left_(variable) + ._right_(expression); + }, + peg$c94 = "^", + peg$c95 = { type: "literal", value: "^", description: "\"^\"" }, + peg$c96 = function(expression) { + return $globals.ReturnNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._nodes_([expression]); + }, + peg$c97 = "|", + peg$c98 = { type: "literal", value: "|", description: "\"|\"" }, + peg$c99 = function(variable) {return variable;}, + peg$c100 = function(vars) {return vars;}, + peg$c101 = function(param) {return param;}, + peg$c102 = function(params) {return params;}, + peg$c103 = function(ret) {return [ret];}, + peg$c104 = function(exps, ret) { + var expressions = exps; + expressions.push(ret); + return expressions; + }, + peg$c105 = function(expressions) { + return expressions || []; + }, + peg$c106 = function(temps, statements) { + return $globals.SequenceNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._temps_(temps || []) + ._nodes_(statements || []); + }, + peg$c107 = "[", + peg$c108 = { type: "literal", value: "[", description: "\"[\"" }, + peg$c109 = "]", + peg$c110 = { type: "literal", value: "]", description: "\"]\"" }, + peg$c111 = function(params, sequence) { + return $globals.BlockNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._parameters_(params || []) + ._nodes_([sequence._asBlockSequenceNode()]); + }, + peg$c112 = void 0, + peg$c113 = function(selector) { + return $globals.SendNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._selector_(selector); + }, + peg$c114 = function(message, tail) { + if(tail) { + return tail._valueForReceiver_(message); + } + else { + return message; + } + }, + peg$c115 = function(receiver, tail) { + if(tail) { + return tail._valueForReceiver_(receiver); + } + else { + return receiver; + } + }, + peg$c116 = function(selector, arg) { + return $globals.SendNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._selector_(selector) + ._arguments_([arg]); + }, + peg$c117 = function(message, tail) { + if(tail) { + return tail._valueForReceiver_(message); + } + else { + return message; + } + }, + peg$c118 = function(pairs) { + var selector = []; + var args = []; + for(var i = 0; i < pairs.length; i++) { + selector.push(pairs[i].key); + args.push(pairs[i].arg); + } + return $globals.SendNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._selector_(selector.join("")) + ._arguments_(args); + }, + peg$c119 = function(receiver, tail) { + return tail._valueForReceiver_(receiver); + }, + peg$c120 = ";", + peg$c121 = { type: "literal", value: ";", description: "\";\"" }, + peg$c122 = function(mess) {return mess;}, + peg$c123 = function(send, messages) { + var cascade = []; + cascade.push(send); + for(var i = 0; i < messages.length; i++) { + cascade.push(messages[i]); + } + return $globals.CascadeNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._receiver_(send._receiver()) + ._nodes_(cascade); + }, + peg$c124 = "<", + peg$c125 = { type: "literal", value: "<", description: "\"<\"" }, + peg$c126 = ">>", + peg$c127 = { type: "literal", value: ">>", description: "\">>\"" }, + peg$c128 = function() {return ">";}, + peg$c129 = /^[^>]/, + peg$c130 = { type: "class", value: "[^>]", description: "[^>]" }, + peg$c131 = ">", + peg$c132 = { type: "literal", value: ">", description: "\">\"" }, + peg$c133 = function(val) { + return $globals.JSStatementNode._new() + ._position_((line()).__at(column())) + ._source_(val.join("")) + }, + peg$c134 = function(pattern, sequence) { + return $globals.MethodNode._new() + ._position_((line()).__at(column())) + ._source_(text()) + ._selector_(pattern[0]) + ._arguments_(pattern[1]) + ._nodes_([sequence]); + }, + peg$c135 = function(send) { return send._selector() === "->" }, + peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; }, + peg$c137 = function(first, others) { return first.concat.apply(first, others); }, -$core.addMethod( -$core.method({ -selector: "pseudoVariables", -protocol: 'accessing', -fn: function (){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._pseudoVariableNames(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["pseudoVariableNames"] -}), -$globals.AbstractCodeGenerator); + peg$currPos = 0, + peg$reportedPos = 0, + peg$cachedPos = 0, + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, -$core.addMethod( -$core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@source"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=""; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source ifNil: [ '' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.AbstractCodeGenerator); + peg$cache = {}, + peg$result; -$core.addMethod( -$core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@source"]=aString; -return self; + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AbstractCodeGenerator); + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + function text() { + return input.substring(peg$reportedPos, peg$currPos); + } + function offset() { + return peg$reportedPos; + } -$core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "compileNode:", -protocol: 'compiling', -fn: function (aNode){ -var self=this; -var ir,stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$recv(self._semanticAnalyzer())._visit_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -ir=$recv(self._translator())._visit_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=2; -//>>excludeEnd("ctx"); -$2=self._irTranslator(); -$recv($2)._currentClass_(self._currentClass()); -$recv($2)._visit_(ir); -$3=$recv($2)._contents(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"] -}), -$globals.CodeGenerator); + function line() { + return peg$computePosDetails(peg$reportedPos).line; + } -$core.addMethod( -$core.method({ -selector: "irTranslator", -protocol: 'compiling', -fn: function (){ -var self=this; -function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($IRJSTranslator())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "irTranslator\x0a\x09^ IRJSTranslator new", -referencedClasses: ["IRJSTranslator"], -//>>excludeEnd("ide"); -messageSends: ["new"] -}), -$globals.CodeGenerator); + function column() { + return peg$computePosDetails(peg$reportedPos).column; + } -$core.addMethod( -$core.method({ -selector: "semanticAnalyzer", -protocol: 'compiling', -fn: function (){ -var self=this; -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($SemanticAnalyzer())._on_(self._currentClass()); -$recv($2)._thePackage_(self._currentPackage()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself", -referencedClasses: ["SemanticAnalyzer"], -//>>excludeEnd("ide"); -messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"] -}), -$globals.CodeGenerator); + function expected(description) { + throw peg$buildException( + null, + [{ type: "other", description: description }], + peg$reportedPos + ); + } -$core.addMethod( -$core.method({ -selector: "translator", -protocol: 'compiling', -fn: function (){ -var self=this; -function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRASTTranslator())._new(); -$recv($2)._source_(self._source()); -$recv($2)._theClass_(self._currentClass()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself", -referencedClasses: ["IRASTTranslator"], -//>>excludeEnd("ide"); -messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"] -}), -$globals.CodeGenerator); + function error(message) { + throw peg$buildException(message, null, peg$reportedPos); + } + function peg$computePosDetails(pos) { + function advance(details, startPos, endPos) { + var p, ch; + for (p = startPos; p < endPos; p++) { + ch = input.charAt(p); + if (ch === "\n") { + if (!details.seenCR) { details.line++; } + details.column = 1; + details.seenCR = false; + } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + details.line++; + details.column = 1; + details.seenCR = true; + } else { + details.column++; + details.seenCR = false; + } + } + } -$core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`"; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "codeGeneratorClass", -protocol: 'accessing', -fn: function (){ -var self=this; -function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@codeGeneratorClass"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=$InliningCodeGenerator(); -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]", -referencedClasses: ["InliningCodeGenerator"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.Compiler); + if (peg$cachedPos !== pos) { + if (peg$cachedPos > pos) { + peg$cachedPos = 0; + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + } + advance(peg$cachedPosDetails, peg$cachedPos, pos); + peg$cachedPos = pos; + } -$core.addMethod( -$core.method({ -selector: "codeGeneratorClass:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -self["@codeGeneratorClass"]=aClass; -return self; + return peg$cachedPosDetails; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } -$core.addMethod( -$core.method({ -selector: "compile:forClass:protocol:", -protocol: 'compiling', -fn: function (aString,aClass,anotherString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -self._source_(aString); -$2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString)); -$1=$2; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aClass", "anotherString"], -source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"] -}), -$globals.Compiler); + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } -$core.addMethod( -$core.method({ -selector: "compileExpression:on:", -protocol: 'compiling', -fn: function (aString,anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["compile:forClass:protocol:", ",", "class"] -}), -$globals.Compiler); + peg$maxFailExpected.push(expected); + } -$core.addMethod( -$core.method({ -selector: "compileNode:", -protocol: 'compiling', -fn: function (aNode){ -var self=this; -var generator,result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -generator=$recv(self._codeGeneratorClass())._new(); -$1=generator; -$recv($1)._source_(self._source()); -$recv($1)._currentClass_(self._currentClass()); -$2=$recv($1)._currentPackage_(self._currentPackage()); -result=$recv(generator)._compileNode_(aNode); -self._unknownVariables_([]); -$3=result; -return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"] -}), -$globals.Compiler); + function peg$buildException(message, expected, pos) { + function cleanupExpected(expected) { + var i = 1; -$core.addMethod( -$core.method({ -selector: "compileNode:forClass:package:", -protocol: 'compiling', -fn: function (aNode,aClass,aPackage){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -self._currentClass_(aClass); -self._currentPackage_(aPackage); -$2=self._compileNode_(aNode); -$1=$2; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode", "aClass", "aPackage"], -source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["currentClass:", "currentPackage:", "compileNode:"] -}), -$globals.Compiler); + expected.sort(function(a, b) { + if (a.description < b.description) { + return -1; + } else if (a.description > b.description) { + return 1; + } else { + return 0; + } + }); -$core.addMethod( -$core.method({ -selector: "currentClass", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@currentClass"]; -return $1; + while (i < expected.length) { + if (expected[i - 1] === expected[i]) { + expected.splice(i, 1); + } else { + i++; + } + } + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "currentClass\x0a\x09^ currentClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + function buildMessage(expected, found) { + function stringEscape(s) { + function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } -$core.addMethod( -$core.method({ -selector: "currentClass:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -self["@currentClass"]=aClass; -return self; + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\x08/g, '\\b') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) + .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) + .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "currentClass: aClass\x0a\x09currentClass := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + var expectedDescs = new Array(expected.length), + expectedDesc, foundDesc, i; -$core.addMethod( -$core.method({ -selector: "currentPackage", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@currentPackage"]; -return $1; + for (i = 0; i < expected.length; i++) { + expectedDescs[i] = expected[i].description; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "currentPackage\x0a\x09^ currentPackage", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + expectedDesc = expected.length > 1 + ? expectedDescs.slice(0, -1).join(", ") + + " or " + + expectedDescs[expected.length - 1] + : expectedDescs[0]; -$core.addMethod( -$core.method({ -selector: "currentPackage:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -self["@currentPackage"]=anObject; -return self; + foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "currentPackage: anObject\x0a\x09currentPackage := anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + return "Expected " + expectedDesc + " but " + foundDesc + " found."; + } -$core.addMethod( -$core.method({ -selector: "eval:", -protocol: 'compiling', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return eval(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "eval: aString\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + var posDetails = peg$computePosDetails(pos), + found = pos < input.length ? input.charAt(pos) : null; -$core.addMethod( -$core.method({ -selector: "eval:forPackage:", -protocol: 'compiling', -fn: function (aString,aPackage){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return aPackage && aPackage.innerEval - ? aPackage.innerEval(aString) - : eval(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aPackage"], -source: "eval: aString forPackage: aPackage\x0a\x09", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + if (expected !== null) { + cleanupExpected(expected); + } -$core.addMethod( -$core.method({ -selector: "evaluateExpression:", -protocol: 'compiling', -fn: function (aString){ -var self=this; -function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._evaluateExpression_on_(aString,$recv($DoIt())._new()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new", -referencedClasses: ["DoIt"], -//>>excludeEnd("ide"); -messageSends: ["evaluateExpression:on:", "new"] -}), -$globals.Compiler); + return new SyntaxError( + message !== null ? message : buildMessage(expected, found), + expected, + found, + pos, + posDetails.line, + posDetails.column + ); + } -$core.addMethod( -$core.method({ -selector: "evaluateExpression:on:", -protocol: 'compiling', -fn: function (aString,anObject){ -var self=this; -var result,method; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -method=self._eval_(self._compileExpression_on_(aString,anObject)); -$recv(method)._protocol_("**xxxDoIt"); -$1=$recv(anObject)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$recv($1)._addCompiledMethod_(method); -result=$recv(anObject)._xxxDoIt(); -$recv($recv(anObject)._class())._removeCompiledMethod_(method); -$2=result; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"] -}), -$globals.Compiler); + function peg$parsestart() { + var s0; -$core.addMethod( -$core.method({ -selector: "install:forClass:protocol:", -protocol: 'compiling', -fn: function (aString,aBehavior,anotherString){ -var self=this; -var compiledMethod; -function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString)); -$1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aBehavior", "anotherString"], -source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString", -referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); -messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"] -}), -$globals.Compiler); + var key = peg$currPos * 60 + 0, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "parse:", -protocol: 'compiling', -fn: function (aString){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._parse_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "parse: aString\x0a\x09^ Smalltalk parse: aString", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:"] -}), -$globals.Compiler); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "parseExpression:", -protocol: 'compiling', -fn: function (aString){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$1=self._parse_($2); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parse:", ","] -}), -$globals.Compiler); + s0 = peg$parsemethod(); -$core.addMethod( -$core.method({ -selector: "recompile:", -protocol: 'compiling', -fn: function (aClass){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),"Recompiling ".__comma($recv(aClass)._name())); -$1=$recv(aClass)._isMetaclass(); -if(!$core.assert($1)){ -self._recompile_($recv(aClass)._class()); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"] -}), -$globals.Compiler); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "recompileAll", -protocol: 'compiling', -fn: function (){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._recompile_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),"Compiling all classes..."); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["do:displayingProgress:", "classes", "recompile:"] -}), -$globals.Compiler); + return s0; + } -$core.addMethod( -$core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@source"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=""; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source ifNil: [ '' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.Compiler); + function peg$parseseparator() { + var s0, s1; -$core.addMethod( -$core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@source"]=aString; -return self; + var key = peg$currPos * 60 + 1, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "unknownVariables", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@unknownVariables"]; -return $1; + s0 = []; + if (peg$c2.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c2.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + } + } else { + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "unknownVariables\x0a\x09^ unknownVariables", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "unknownVariables:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@unknownVariables"]=aCollection; -return self; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Compiler); + function peg$parsecomments() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 60 + 2, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "recompile:", -protocol: 'compiling', -fn: function (aClass){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._new())._recompile_(aClass); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "recompile: aClass\x0a\x09self new recompile: aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["recompile:", "new"] -}), -$globals.Compiler.klass); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "recompileAll", -protocol: 'compiling', -fn: function (){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($Smalltalk())._classes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._recompile_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["do:", "classes", "recompile:"] -}), -$globals.Compiler.klass); + s0 = []; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c4; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c6.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c6.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c4; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c4; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c6.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c6.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c4; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } + } else { + s0 = peg$c1; + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addClass('DoIt', $globals.Object, [], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`."; -//>>excludeEnd("ide"); + return s0; + } + function peg$parsews() { + var s0, s1; -$core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "evaluate:context:", -protocol: 'evaluating', -fn: function (aString,aContext){ -var self=this; -var compiler,ast; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -var $early={}; -try { -compiler=$recv($Compiler())._new(); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -ast=$recv(compiler)._parseExpression_(aString); -return ast; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._alert_($recv(ex)._messageText()); -throw $early=[$1]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class()); -$recv($2)._context_(aContext); -$3=$recv($2)._visit_(ast); -$4=$recv(aContext)._evaluateNode_(ast); -return $4; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aContext"], -source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast", -referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"], -//>>excludeEnd("ide"); -messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"] -}), -$globals.Evaluator); + var key = peg$currPos * 60 + 3, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "evaluate:for:", -protocol: 'evaluating', -fn: function (aString,anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(anObject)._evaluate_on_(aString,self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["evaluate:on:"] -}), -$globals.Evaluator); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "evaluate:receiver:", -protocol: 'evaluating', -fn: function (aString,anObject){ -var self=this; -var compiler; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -compiler=$recv($Compiler())._new(); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(compiler)._parseExpression_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._alert_($recv(ex)._messageText()); -throw $early=[$1]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$2=$recv(compiler)._evaluateExpression_on_(aString,anObject); -return $2; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject", -referencedClasses: ["Compiler", "Error"], -//>>excludeEnd("ide"); -messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"] -}), -$globals.Evaluator); + s0 = []; + s1 = peg$parseseparator(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomments(); + } + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parseseparator(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomments(); + } + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "evaluate:for:", -protocol: 'instance creation', -fn: function (aString,anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._new())._evaluate_for_(aString,anObject); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["evaluate:for:", "new"] -}), -$globals.Evaluator.klass); + return s0; + } + function peg$parseidentifier() { + var s0, s1, s2, s3; -$core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "visit:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aNode)._accept_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visit: aNode\x0a\x09^ aNode accept: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["accept:"] -}), -$globals.NodeVisitor); + var key = peg$currPos * 60 + 4, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "visitAll:", -protocol: 'visiting', -fn: function (aCollection){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aCollection)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collect:", "visit:"] -}), -$globals.NodeVisitor); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "visitAssignmentNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + s0 = peg$currPos; + if (peg$c8.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c10.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c10.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c12(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "visitBlockNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "visitBlockSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitSequenceNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitSequenceNode:"] -}), -$globals.NodeVisitor); + return s0; + } -$core.addMethod( -$core.method({ -selector: "visitCascadeNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + function peg$parsekeyword() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "visitDynamicArrayNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + var key = peg$currPos * 60 + 5, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "visitDynamicDictionaryNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "visitJSStatementNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + s0 = peg$currPos; + s1 = peg$parseidentifier(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c15(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "visitMethodNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "visitNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitAll_($recv(aNode)._nodes()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitAll:", "nodes"] -}), -$globals.NodeVisitor); + return s0; + } -$core.addMethod( -$core.method({ -selector: "visitReturnNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + function peg$parseselector() { + var s0, s1, s2, s3; -$core.addMethod( -$core.method({ -selector: "visitSendNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + var key = peg$currPos * 60 + 6, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "visitSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "visitValueNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + s0 = peg$currPos; + if (peg$c8.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c16.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c17); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c16.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c17); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c12(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "visitVariableNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitNode_(aNode); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.NodeVisitor); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } -$core.addMethod( -$core.method({ -selector: "asVariableName", -protocol: '*Compiler-Core', -fn: function (){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv($recv($Smalltalk())._reservedWords())._includes_(self); -if($core.assert($2)){ -$1=self.__comma("_"); -} else { -$1=self; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","] -}), -$globals.String); + function peg$parseclassName() { + var s0, s1, s2, s3; -}); + var key = peg$currPos * 60 + 7, + cached = peg$cache[key]; -define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-AST'); -$core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"}; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitNode:"] -}), -$globals.Node); + s0 = peg$currPos; + if (peg$c18.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c19); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c10.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c10.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c12(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "addNode:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._nodes())._add_(aNode); -$recv(aNode)._parent_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "nodes", "parent:"] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "allNodes", -protocol: 'accessing', -fn: function (){ -var self=this; -var allNodes; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -allNodes=$recv($1)._asSet(); -$recv(self._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(allNodes)._addAll_($recv(each)._allNodes()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$2=allNodes; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"] -}), -$globals.Node); + return s0; + } -$core.addMethod( -$core.method({ -selector: "inPosition:", -protocol: 'testing', -fn: function (aPoint){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._positionEnd()).__gt_eq(aPoint); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPoint"], -source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"] -}), -$globals.Node); + function peg$parsestring() { + var s0, s1, s2, s3, s4; -$core.addMethod( -$core.method({ -selector: "isAssignmentNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + var key = peg$currPos * 60 + 8, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isAssignmentNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isBlockNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c20; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c22) { + s4 = peg$c22; + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c23); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c24(); + } + s3 = s4; + if (s3 === peg$FAILED) { + if (peg$c25.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c22) { + s4 = peg$c22; + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c23); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c24(); + } + s3 = s4; + if (s3 === peg$FAILED) { + if (peg$c25.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c20; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c27(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isBlockNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "isBlockSequenceNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isBlockSequenceNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + function peg$parsecharacter() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "isCascadeNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + var key = peg$currPos * 60 + 9, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isCascadeNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isImmutable", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 36) { + s1 = peg$c28; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c29); } + } + if (s1 !== peg$FAILED) { + if (input.length > peg$currPos) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c31(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isImmutable\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "isJSStatementNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isJSStatementNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + function peg$parsesymbol() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "isLastChild", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isLastChild\x0a\x09^ self parent nodes last = self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["=", "last", "nodes", "parent"] -}), -$globals.Node); + var key = peg$currPos * 60 + 10, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isNavigationNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c32; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsebareSymbol(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c34(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "isNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isReferenced", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -$4=self._parent(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["parent"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._isSequenceNode(); -$2=$recv($3)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._parent())._isAssignmentNode(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=$recv($2)._not(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"] -}), -$globals.Node); + function peg$parsebareSymbol() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "isReturnNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + var key = peg$currPos * 60 + 11, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isReturnNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isSendNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + s0 = peg$currPos; + s1 = peg$parseselector(); + if (s1 === peg$FAILED) { + s1 = peg$parsebinarySelector(); + if (s1 === peg$FAILED) { + s1 = peg$currPos; + s2 = peg$parsestring(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c35(s2); + } + s1 = s2; + } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c36(s1); + } + s0 = s1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSendNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "isSequenceNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSequenceNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + function peg$parsenumber() { + var s0, s1; -$core.addMethod( -$core.method({ -selector: "isValueNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + var key = peg$currPos * 60 + 12, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isValueNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isVariableNode", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + s0 = peg$currPos; + s1 = peg$parsenumberExp(); + if (s1 === peg$FAILED) { + s1 = peg$parsehex(); + if (s1 === peg$FAILED) { + s1 = peg$parsefloat(); + if (s1 === peg$FAILED) { + s1 = peg$parseinteger(); + } + } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c37(s1); + } + s0 = s1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isVariableNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "method", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self._parent(); -if(($receiver = $2) == null || $receiver.isNil){ -$1=$2; -} else { -var node; -node=$receiver; -$1=$recv(node)._method(); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "parent", "method"] -}), -$globals.Node); - -$core.addMethod( -$core.method({ -selector: "navigationNodeAt:ifAbsent:", -protocol: 'accessing', -fn: function (aPoint,aBlock){ -var self=this; -var children; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$4,$3,$2; -var $early={}; -try { -children=$recv(self._allNodes())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._isNavigationNode())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(each)._inPosition_(aPoint); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv(children)._ifEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(aBlock)._value(); -throw $early=[$1]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(a)._positionStart(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["positionStart"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._dist_(aPoint); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["dist:"]=1; -//>>excludeEnd("ctx"); -return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)}); -//>>excludeEnd("ctx"); -})))._first(); -return $2; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPoint", "aBlock"], -source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"] -}), -$globals.Node); - -$core.addMethod( -$core.method({ -selector: "nextChild", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -$3=self._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._isEmpty(); -if($core.assert($2)){ -$1=self; -} else { -$1=$recv($recv(self._nodes())._first())._nextChild(); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"] -}), -$globals.Node); - -$core.addMethod( -$core.method({ -selector: "nextNode", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self._parent(); -if(($receiver = $2) == null || $receiver.isNil){ -$1=$2; -} else { -var node; -node=$receiver; -$1=$recv(node)._nextNode_(self); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "parent", "nextNode:"] -}), -$globals.Node); - -$core.addMethod( -$core.method({ -selector: "nextNode:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -var next; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -$1=self._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){ -throw $early=[self]; + return s0; + } -})); -$2=$recv(next)._nextChild(); -return $2; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"] -}), -$globals.Node); + function peg$parsenumberExp() { + var s0, s1, s2, s3, s4; -$core.addMethod( -$core.method({ -selector: "nodes", -protocol: 'accessing', -fn: function (){ -var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@nodes"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@nodes"]=$recv($Array())._new(); -$1=self["@nodes"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] -}), -$globals.Node); + var key = peg$currPos * 60 + 13, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "nodes:", -protocol: 'building', -fn: function (aCollection){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@nodes"]=aCollection; -$recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._parent_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "parent:"] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "parent", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@parent"]; -return $1; + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parsefloat(); + if (s2 === peg$FAILED) { + s2 = peg$parseinteger(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 101) { + s3 = peg$c38; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c39); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseinteger(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + } else { + peg$currPos = s1; + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c40(s1); + } + s0 = s1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "parent\x0a\x09^ parent", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "parent:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -self["@parent"]=aNode; -return self; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "parent: aNode\x0a\x09parent := aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + function peg$parsehex() { + var s0, s1, s2, s3, s4; -$core.addMethod( -$core.method({ -selector: "position", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$receiver; -$2=self["@position"]; -if(($receiver = $2) == null || $receiver.isNil){ -$3=self._parent(); -if(($receiver = $3) == null || $receiver.isNil){ -$1=$3; -} else { -var node; -node=$receiver; -$1=$recv(node)._position(); -}; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "ifNotNil:", "parent", "position"] -}), -$globals.Node); + var key = peg$currPos * 60 + 14, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "position:", -protocol: 'accessing', -fn: function (aPosition){ -var self=this; -self["@position"]=aPosition; -return self; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPosition"], -source: "position: aPosition\x0a\x09position := aPosition", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 === peg$FAILED) { + s1 = peg$c41; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c44) { + s2 = peg$c44; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c45); } + } + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c46.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c46.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + } + } else { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c48(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "positionEnd", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$7,$6,$5,$4,$3,$1; -$2=self._positionStart(); -$7=self._source(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["source"]=1; -//>>excludeEnd("ctx"); -$6=$recv($7)._lines(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lines"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5).__minus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["-"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1))); -$1=$recv($2).__plus($3); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "positionStart", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._position(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "positionStart\x0a\x09^ self position", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["position"] -}), -$globals.Node); + return s0; + } -$core.addMethod( -$core.method({ -selector: "postCopy", -protocol: 'copying', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(self._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._parent_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["postCopy", "do:", "nodes", "parent:"] -}), -$globals.Node); + function peg$parsefloat() { + var s0, s1, s2, s3, s4, s5; -$core.addMethod( -$core.method({ -selector: "requiresSmalltalkContext", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._nodes())._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._requiresSmalltalkContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -return nil; + var key = peg$currPos * 60 + 15, + cached = peg$cache[key]; -})))._notNil(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "shouldBeAliased", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@shouldBeAliased"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=false; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.Node); - -$core.addMethod( -$core.method({ -selector: "shouldBeAliased:", -protocol: 'accessing', -fn: function (aBoolean){ -var self=this; -self["@shouldBeAliased"]=aBoolean; -return self; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 === peg$FAILED) { + s1 = peg$c41; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + } + } else { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c51; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (peg$c49.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + if (peg$c49.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + } + } else { + s4 = peg$c1; + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c53(s1, s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "shouldBeInlined", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@shouldBeInlined"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=false; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.Node); + return s0; + } -$core.addMethod( -$core.method({ -selector: "shouldBeInlined:", -protocol: 'accessing', -fn: function (aBoolean){ -var self=this; -self["@shouldBeInlined"]=aBoolean; -return self; + function peg$parseinteger() { + var s0, s1, s2, s3; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + var key = peg$currPos * 60 + 16, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "size", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._source())._size(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "size\x0a\x09^ self source size", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["size", "source"] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@source"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=""; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source ifNil: [ '' ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.Node); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 === peg$FAILED) { + s1 = peg$c41; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + } + } else { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c54(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@source"]=aString; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + return s0; + } -$core.addMethod( -$core.method({ -selector: "stopOnStepping", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + function peg$parseliteralArray() { + var s0, s1, s2; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "stopOnStepping\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Node); + var key = peg$currPos * 60 + 17, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "subtreeNeedsAliasing", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._shouldBeAliased())._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._shouldBeInlined(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._nodes())._anySatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(each)._subtreeNeedsAliasing(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"] -}), -$globals.Node); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c55) { + s1 = peg$c55; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c56); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseliteralArrayRest(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c34(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AssignmentNode.comment="I represent an assignment node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitAssignmentNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitAssignmentNode:"] -}), -$globals.AssignmentNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isAssignmentNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + function peg$parsebareLiteralArray() { + var s0, s1, s2; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isAssignmentNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AssignmentNode); + var key = peg$currPos * 60 + 18, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "left", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@left"]; -return $1; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "left\x0a\x09^ left", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AssignmentNode); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c57; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c58); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseliteralArrayRest(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c34(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "left:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@left"]=aNode; -$recv(aNode)._parent_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parent:"] -}), -$globals.AssignmentNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "nodes", -protocol: 'accessing', -fn: function (){ -var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Array())._with_with_(self._left(),self._right()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nodes\x0a\x09^ Array with: self left with: self right", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["with:with:", "left", "right"] -}), -$globals.AssignmentNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "right", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@right"]; -return $1; + function peg$parseliteralArrayRest() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "right\x0a\x09^ right", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AssignmentNode); - -$core.addMethod( -$core.method({ -selector: "right:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@right"]=aNode; -$recv(aNode)._parent_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parent:"] -}), -$globals.AssignmentNode); - -$core.addMethod( -$core.method({ -selector: "shouldBeAliased", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=$recv($2)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._isReferenced(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["or:", "shouldBeAliased", "isReferenced"] -}), -$globals.AssignmentNode); + var key = peg$currPos * 60 + 19, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = []; + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseparseTimeLiteral(); + if (s4 === peg$FAILED) { + s4 = peg$parsebareLiteralArray(); + if (s4 === peg$FAILED) { + s4 = peg$parsebareSymbol(); + } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c59(s4); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseparseTimeLiteral(); + if (s4 === peg$FAILED) { + s4 = peg$parsebareLiteralArray(); + if (s4 === peg$FAILED) { + s4 = peg$parsebareSymbol(); + } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c59(s4); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s3 = peg$c60; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c62(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.BlockNode.comment="I represent an block closure node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitBlockNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitBlockNode:"] -}), -$globals.BlockNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "isBlockNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isBlockNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + function peg$parsedynamicArray() { + var s0, s1, s2, s3, s4, s5, s6; -$core.addMethod( -$core.method({ -selector: "nextChild", -protocol: 'accessing', -fn: function (){ -var self=this; -return self; + var key = peg$currPos * 60 + 20, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "nextNode:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -return self; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c63; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c64); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseexpressions(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c51; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s5 === peg$FAILED) { + s5 = peg$c41; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s6 = peg$c65; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c67(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "parameters", -protocol: 'accessing', -fn: function (){ -var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@parameters"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@parameters"]=$recv($Array())._new(); -$1=self["@parameters"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] -}), -$globals.BlockNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "parameters:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@parameters"]=aCollection; -return self; + function peg$parsedynamicDictionary() { + var s0, s1, s2, s3, s4, s5; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "parameters: aCollection\x0a\x09parameters := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + var key = peg$currPos * 60 + 21, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@scope"]; -return $1; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c68) { + s1 = peg$c68; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseassociations(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c65; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c70(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aLexicalScope){ -var self=this; -self["@scope"]=aLexicalScope; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aLexicalScope"], -source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "subtreeNeedsAliasing", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._shouldBeAliased())._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._shouldBeInlined(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"] -}), -$globals.BlockNode); + function peg$parsepseudoVariable() { + var s0, s1, s2; + var key = peg$currPos * 60 + 22, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.CascadeNode.comment="I represent an cascade node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitCascadeNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitCascadeNode:"] -}), -$globals.CascadeNode); + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c71) { + s2 = peg$c71; + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c73(); + } + s1 = s2; + if (s1 === peg$FAILED) { + s1 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c74) { + s2 = peg$c74; + peg$currPos += 5; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c76(); + } + s1 = s2; + if (s1 === peg$FAILED) { + s1 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c77) { + s2 = peg$c77; + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c78); } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c79(); + } + s1 = s2; + } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c80(s1); + } + s0 = s1; -$core.addMethod( -$core.method({ -selector: "isCascadeNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isCascadeNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.CascadeNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "receiver", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@receiver"]; -return $1; + function peg$parseparseTimeLiteral() { + var s0; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "receiver\x0a\x09^ receiver", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.CascadeNode); - -$core.addMethod( -$core.method({ -selector: "receiver:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -self["@receiver"]=aNode; -return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "receiver: aNode\x0a\x09receiver := aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.CascadeNode); - - - -$core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.DynamicArrayNode.comment="I represent an dynamic array node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitDynamicArrayNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitDynamicArrayNode:"] -}), -$globals.DynamicArrayNode); + var key = peg$currPos * 60 + 23, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$parsepseudoVariable(); + if (s0 === peg$FAILED) { + s0 = peg$parsenumber(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteralArray(); + if (s0 === peg$FAILED) { + s0 = peg$parsestring(); + if (s0 === peg$FAILED) { + s0 = peg$parsesymbol(); + if (s0 === peg$FAILED) { + s0 = peg$parsecharacter(); + } + } + } + } + } -$core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitDynamicDictionaryNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitDynamicDictionaryNode:"] -}), -$globals.DynamicDictionaryNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseruntimeLiteral() { + var s0; -$core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.JSStatementNode.comment="I represent an JavaScript statement node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitJSStatementNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitJSStatementNode:"] -}), -$globals.JSStatementNode); + var key = peg$currPos * 60 + 24, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isJSStatementNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isJSStatementNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.JSStatementNode); + s0 = peg$parsedynamicDictionary(); + if (s0 === peg$FAILED) { + s0 = peg$parsedynamicArray(); + if (s0 === peg$FAILED) { + s0 = peg$parseblock(); + } + } -$core.addMethod( -$core.method({ -selector: "requiresSmalltalkContext", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "requiresSmalltalkContext\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.JSStatementNode); + return s0; + } + function peg$parseliteral() { + var s0; + var key = peg$currPos * 60 + 25, + cached = peg$cache[key]; -$core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitMethodNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitMethodNode:"] -}), -$globals.MethodNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "arguments", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@arguments"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=[]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "arguments\x0a\x09^ arguments ifNil: [ #() ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.MethodNode); + s0 = peg$parseruntimeLiteral(); + if (s0 === peg$FAILED) { + s0 = peg$parseparseTimeLiteral(); + } -$core.addMethod( -$core.method({ -selector: "arguments:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@arguments"]=aCollection; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "arguments: aCollection\x0a\x09arguments := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "classReferences", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@classReferences"]; -return $1; + function peg$parsevariable() { + var s0, s1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "classReferences\x0a\x09^ classReferences", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + var key = peg$currPos * 60 + 26, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "classReferences:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@classReferences"]=aCollection; -return self; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "classReferences: aCollection\x0a\x09classReferences := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + s0 = peg$currPos; + s1 = peg$parseidentifier(); + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c81(s1); + } + s0 = s1; -$core.addMethod( -$core.method({ -selector: "messageSends", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._sendIndexes())._keys(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "messageSends\x0a\x09^ self sendIndexes keys", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["keys", "sendIndexes"] -}), -$globals.MethodNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "method", -protocol: 'accessing', -fn: function (){ -var self=this; -return self; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "method\x0a\x09^ self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + function peg$parsekeywordPair() { + var s0, s1, s2, s3, s4; -$core.addMethod( -$core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@scope"]; -return $1; + var key = peg$currPos * 60 + 27, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aMethodScope){ -var self=this; -self["@scope"]=aMethodScope; -return self; + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parsekeyword(); + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parsebinarySend(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c82(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethodScope"], -source: "scope: aMethodScope\x0a\x09scope := aMethodScope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "selector", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@selector"]; -return $1; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "selector\x0a\x09^ selector", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + function peg$parsebinarySelector() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "selector:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@selector"]=aString; -return self; + var key = peg$currPos * 60 + 28, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "sendIndexes", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@sendIndexes"]; -return $1; + s0 = peg$currPos; + s1 = []; + if (peg$c83.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c84); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c83.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c84); } + } + } + } else { + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c85(s1); + } + s0 = s1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sendIndexes\x0a\x09^ sendIndexes", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "sendIndexes:", -protocol: 'accessing', -fn: function (aDictionary){ -var self=this; -self["@sendIndexes"]=aDictionary; -return self; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aDictionary"], -source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + function peg$parsekeywordPattern() { + var s0, s1, s2, s3, s4, s5, s6; -$core.addMethod( -$core.method({ -selector: "sequenceNode", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -var $early={}; -try { -$recv(self._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(each)._isSequenceNode(); -if($core.assert($1)){ -throw $early=[each]; -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return nil; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"] -}), -$globals.MethodNode); + var key = peg$currPos * 60 + 29, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@source"]; -return $1; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + s0 = peg$currPos; + s1 = []; + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parsekeyword(); + if (s4 !== peg$FAILED) { + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifier(); + if (s6 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c82(s4, s6); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parsekeyword(); + if (s4 !== peg$FAILED) { + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifier(); + if (s6 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c82(s4, s6); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } + } else { + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c86(s1); + } + s0 = s1; -$core.addMethod( -$core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@source"]=aString; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "superSends", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@superSends"]; -return $1; + function peg$parsebinaryPattern() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "superSends\x0a\x09^ superSends", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + var key = peg$currPos * 60 + 30, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "superSends:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@superSends"]=aCollection; -return self; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "superSends: aCollection\x0a\x09superSends := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.MethodNode); + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parsebinarySelector(); + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseidentifier(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c87(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } -$core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitReturnNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitReturnNode:"] -}), -$globals.ReturnNode); + function peg$parseunaryPattern() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "isReturnNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + var key = peg$currPos * 60 + 31, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isReturnNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ReturnNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "nonLocalReturn", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._scope())._isMethodScope())._not(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["not", "isMethodScope", "scope"] -}), -$globals.ReturnNode); + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifier(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c88(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@scope"]; -return $1; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ReturnNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aLexicalScope){ -var self=this; -self["@scope"]=aLexicalScope; -return self; + function peg$parseexpression() { + var s0; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aLexicalScope"], -source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ReturnNode); + var key = peg$currPos * 60 + 32, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$parseassignment(); + if (s0 === peg$FAILED) { + s0 = peg$parsecascade(); + if (s0 === peg$FAILED) { + s0 = peg$parsekeywordSend(); + if (s0 === peg$FAILED) { + s0 = peg$parsebinarySend(); + } + } + } -$core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.SendNode.comment="I represent an message send node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitSendNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitSendNode:"] -}), -$globals.SendNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "arguments", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@arguments"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@arguments"]=[]; -$1=self["@arguments"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.SendNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "arguments:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@arguments"]=aCollection; -$recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._parent_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "parent:"] -}), -$globals.SendNode); + function peg$parseexpressionList() { + var s0, s1, s2, s3, s4; -$core.addMethod( -$core.method({ -selector: "cascadeNodeWithMessages:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -var first; -function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)} -function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)} -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$5,$3; -$1=$recv($SendNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._selector_(self._selector()); -$recv($1)._arguments_(self._arguments()); -$2=$recv($1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -first=$2; -$4=$recv($CascadeNode())._new(); -$recv($4)._receiver_(self._receiver()); -$recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection)); -$5=$recv($4)._yourself(); -$3=$5; -return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself", -referencedClasses: ["SendNode", "CascadeNode", "Array"], -//>>excludeEnd("ide"); -messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"] -}), -$globals.SendNode); + var key = peg$currPos * 60 + 33, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "index", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@index"]; -return $1; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "index\x0a\x09^ index", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c51; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseexpression(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c89(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "index:", -protocol: 'accessing', -fn: function (anInteger){ -var self=this; -self["@index"]=anInteger; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInteger"], -source: "index: anInteger\x0a\x09index := anInteger", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isCascadeSendNode", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._parent())._isCascadeNode(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isCascadeNode", "parent"] -}), -$globals.SendNode); + function peg$parseexpressions() { + var s0, s1, s2, s3; -$core.addMethod( -$core.method({ -selector: "isNavigationNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + var key = peg$currPos * 60 + 34, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNavigationNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isSendNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSendNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + s0 = peg$currPos; + s1 = peg$parseexpression(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseexpressionList(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseexpressionList(); + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c90(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "navigationLink", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._selector(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "navigationLink\x0a\x09^ self selector", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["selector"] -}), -$globals.SendNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "nodes", -protocol: 'accessing', -fn: function (){ -var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$5,$6,$4,$receiver; -$1=self._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $1) == null || $receiver.isNil){ -$3=self._arguments(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["arguments"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._copy(); -return $2; -} else { -$1; -}; -$5=$recv($Array())._with_(self._receiver()); -$recv($5)._addAll_(self._arguments()); -$6=$recv($5)._yourself(); -$4=$6; -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"] -}), -$globals.SendNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "receiver", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@receiver"]; -return $1; + function peg$parseassignment() { + var s0, s1, s2, s3, s4, s5; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "receiver\x0a\x09^ receiver", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + var key = peg$currPos * 60 + 35, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "receiver:", -protocol: 'accessing', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self["@receiver"]=aNode; -$1=$recv(aNode)._isNode(); -if($core.assert($1)){ -$recv(aNode)._parent_(self); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "isNode", "parent:"] -}), -$globals.SendNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "requiresSmalltalkContext", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + s0 = peg$currPos; + s1 = peg$parsevariable(); + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c91) { + s3 = peg$c91; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c92); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + s5 = peg$parseexpression(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c93(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "requiresSmalltalkContext\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "selector", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@selector"]; -return $1; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "selector\x0a\x09^ selector", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + function peg$parseret() { + var s0, s1, s2, s3, s4, s5; -$core.addMethod( -$core.method({ -selector: "selector:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@selector"]=aString; -return self; + var key = peg$currPos * 60 + 36, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "shouldBeAliased", -protocol: 'testing', -fn: function (){ -var self=this; -var sends; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size(); -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=$recv($2)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._isReferenced())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv($recv(sends).__gt((1)))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -return $recv(self._index()).__lt(sends); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)}); -//>>excludeEnd("ctx"); -})))._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -return self._superSend(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"] -}), -$globals.SendNode); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 94) { + s1 = peg$c94; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c95); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseexpression(); + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c51; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s5 === peg$FAILED) { + s5 = peg$c41; + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c96(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "stopOnStepping", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "stopOnStepping\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "superSend", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@superSend"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=false; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "superSend\x0a\x09^ superSend ifNil: [ false ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.SendNode); + function peg$parsetemps() { + var s0, s1, s2, s3, s4, s5; -$core.addMethod( -$core.method({ -selector: "superSend:", -protocol: 'accessing', -fn: function (aBoolean){ -var self=this; -self["@superSend"]=aBoolean; -return self; + var key = peg$currPos * 60 + 37, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "superSend: aBoolean\x0a\x09superSend := aBoolean", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SendNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "valueForReceiver:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$5,$4,$6,$1,$receiver; -$2=$recv($SendNode())._new(); -$recv($2)._position_(self._position()); -$recv($2)._source_(self._source()); -$3=$2; -$5=self._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $5) == null || $receiver.isNil){ -$4=anObject; -} else { -$4=$recv(self._receiver())._valueForReceiver_(anObject); -}; -$recv($3)._receiver_($4); -$recv($2)._selector_(self._selector()); -$recv($2)._arguments_(self._arguments()); -$6=$recv($2)._yourself(); -$1=$6; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself", -referencedClasses: ["SendNode"], -//>>excludeEnd("ide"); -messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"] -}), -$globals.SendNode); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 124) { + s1 = peg$c97; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifier(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c99(s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c1; + } + } else { + peg$currPos = s3; + s3 = peg$c1; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifier(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c99(s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c1; + } + } else { + peg$currPos = s3; + s3 = peg$c1; + } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 124) { + s4 = peg$c97; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c100(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } -$core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope)."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitSequenceNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitSequenceNode:"] -}), -$globals.SequenceNode); + function peg$parseblockParamList() { + var s0, s1, s2, s3, s4, s5, s6; -$core.addMethod( -$core.method({ -selector: "asBlockSequenceNode", -protocol: 'converting', -fn: function (){ -var self=this; -function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($BlockSequenceNode())._new(); -$recv($2)._position_(self._position()); -$recv($2)._source_(self._source()); -$recv($2)._nodes_(self._nodes()); -$recv($2)._temps_(self._temps()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself", -referencedClasses: ["BlockSequenceNode"], -//>>excludeEnd("ide"); -messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"] -}), -$globals.SequenceNode); + var key = peg$currPos * 60 + 38, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isSequenceNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSequenceNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SequenceNode); + s0 = peg$currPos; + s1 = []; + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s4 = peg$c13; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifier(); + if (s6 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c101(s6); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s4 = peg$c13; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifier(); + if (s6 !== peg$FAILED) { + peg$reportedPos = s2; + s3 = peg$c101(s6); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } else { + peg$currPos = s2; + s2 = peg$c1; + } + } + } else { + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 124) { + s3 = peg$c97; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c102(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@scope"]; -return $1; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SequenceNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aLexicalScope){ -var self=this; -self["@scope"]=aLexicalScope; -return self; + function peg$parsesubexpression() { + var s0, s1, s2, s3, s4, s5; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aLexicalScope"], -source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SequenceNode); + var key = peg$currPos * 60 + 39, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "temps", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@temps"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=[]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "temps\x0a\x09^ temps ifNil: [ #() ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.SequenceNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "temps:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@temps"]=aCollection; -return self; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c57; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c58); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseexpression(); + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c60; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c89(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "temps: aCollection\x0a\x09temps := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.SequenceNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parsestatements() { + var s0, s1, s2, s3, s4, s5, s6, s7; -$core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitBlockSequenceNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitBlockSequenceNode:"] -}), -$globals.BlockSequenceNode); + var key = peg$currPos * 60 + 40, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isBlockSequenceNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isBlockSequenceNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.BlockSequenceNode); + s0 = peg$currPos; + s1 = peg$parseret(); + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c51; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c51; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c103(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseexpressions(); + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = []; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + } + } else { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + s5 = peg$parseret(); + if (s5 !== peg$FAILED) { + s6 = []; + if (input.charCodeAt(peg$currPos) === 46) { + s7 = peg$c51; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + while (s7 !== peg$FAILED) { + s6.push(s7); + if (input.charCodeAt(peg$currPos) === 46) { + s7 = peg$c51; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c104(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseexpressions(); + if (s1 === peg$FAILED) { + s1 = peg$c41; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c51; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c51; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c105(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } + } + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } -$core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ValueNode.comment="I represent a value node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitValueNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitValueNode:"] -}), -$globals.ValueNode); + function peg$parsesequence() { + var s0; -$core.addMethod( -$core.method({ -selector: "isImmutable", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._value())._isImmutable(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isImmutable\x0a\x09^ self value isImmutable", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isImmutable", "value"] -}), -$globals.ValueNode); + var key = peg$currPos * 60 + 41, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isValueNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isValueNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ValueNode); + s0 = peg$parsejsStatement(); + if (s0 === peg$FAILED) { + s0 = peg$parsestSequence(); + } -$core.addMethod( -$core.method({ -selector: "value", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@value"]; -return $1; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "value\x0a\x09^ value", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ValueNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "value:", -protocol: 'accessing', -fn: function (anObject){ -var self=this; -self["@value"]=anObject; -return self; + function peg$parsestSequence() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "value: anObject\x0a\x09value := anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.ValueNode); + var key = peg$currPos * 60 + 42, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parsetemps(); + if (s1 === peg$FAILED) { + s1 = peg$c41; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parsestatements(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c106(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.VariableNode.comment="I represent an variable node."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitVariableNode_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitVariableNode:"] -}), -$globals.VariableNode); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "alias", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._binding())._alias(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "alias\x0a\x09^ self binding alias", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["alias", "binding"] -}), -$globals.VariableNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "assigned", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@assigned"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=false; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "assigned\x0a\x09^ assigned ifNil: [ false ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] -}), -$globals.VariableNode); + function peg$parseblock() { + var s0, s1, s2, s3, s4, s5, s6; -$core.addMethod( -$core.method({ -selector: "assigned:", -protocol: 'accessing', -fn: function (aBoolean){ -var self=this; -self["@assigned"]=aBoolean; -return self; + var key = peg$currPos * 60 + 43, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "assigned: aBoolean\x0a\x09assigned := aBoolean", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.VariableNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "beAssigned", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._binding())._validateAssignment(); -self["@assigned"]=true; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["validateAssignment", "binding"] -}), -$globals.VariableNode); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c107; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseblockParamList(); + if (s2 === peg$FAILED) { + s2 = peg$c41; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parsesequence(); + if (s4 === peg$FAILED) { + s4 = peg$c41; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s6 = peg$c109; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c110); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c111(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "binding", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@binding"]; -return $1; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "binding\x0a\x09^ binding", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.VariableNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "binding:", -protocol: 'accessing', -fn: function (aScopeVar){ -var self=this; -self["@binding"]=aScopeVar; -return self; + function peg$parseoperand() { + var s0; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScopeVar"], -source: "binding: aScopeVar\x0a\x09binding := aScopeVar", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.VariableNode); + var key = peg$currPos * 60 + 44, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isArgument", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._binding())._isArgVar(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isArgument\x0a\x09^ self binding isArgVar", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isArgVar", "binding"] -}), -$globals.VariableNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "isImmutable", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._binding())._isImmutable(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isImmutable\x0a\x09^ self binding isImmutable", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isImmutable", "binding"] -}), -$globals.VariableNode); + s0 = peg$parseliteral(); + if (s0 === peg$FAILED) { + s0 = peg$parsevariable(); + if (s0 === peg$FAILED) { + s0 = peg$parsesubexpression(); + } + } -$core.addMethod( -$core.method({ -selector: "isNavigationNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNavigationNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.VariableNode); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isVariableNode", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + function peg$parseunaryMessage() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isVariableNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.VariableNode); + var key = peg$currPos * 60 + 45, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "navigationLink", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._value(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "navigationLink\x0a\x09^ self value", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value"] -}), -$globals.VariableNode); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifier(); + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 58) { + s4 = peg$c13; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + peg$silentFails--; + if (s4 === peg$FAILED) { + s3 = peg$c112; + } else { + peg$currPos = s3; + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c113(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "ast", -protocol: '*Compiler-AST', -fn: function (){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self._source(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["source"]=1; -//>>excludeEnd("ctx"); -$recv($1)._ifEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._error_("Method source is empty"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$2=$recv($Smalltalk())._parse_(self._source()); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["ifEmpty:", "source", "error:", "parse:"] -}), -$globals.CompiledMethod); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "isNode", -protocol: '*Compiler-AST', -fn: function (){ -var self=this; -return false; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNode\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.Object); + function peg$parseunaryTail() { + var s0, s1, s2, s3, s4; -}); + var key = peg$currPos * 60 + 46, + cached = peg$cache[key]; -define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-IR'); -$core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"}; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "alias:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var variable; -function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} -function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} -function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12; -$1=$recv(aNode)._isImmutable(); -if($core.assert($1)){ -$2=self._visit_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $2; -}; -$3=$recv($IRVariable())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$4=$3; -$6=$recv($AliasVar())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._name_("$".__comma(self._nextAlias())); -$recv($4)._variable_($5); -$7=$recv($3)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -variable=$7; -$8=self._sequence(); -$10=$recv($IRAssignment())._new(); -$recv($10)._add_(variable); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv($10)._add_(self._visit_(aNode)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$11=$recv($10)._yourself(); -$9=$11; -$recv($8)._add_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(self._method())._internalVariables())._add_(variable); -$12=variable; -return $12; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable", -referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = peg$parseunaryMessage(); + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseunaryTail(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c114(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "aliasTemporally:", -protocol: 'visiting', -fn: function (aCollection){ -var self=this; -var threshold,result; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$5; -threshold=(0); -$recv(aCollection)._withIndexDo_((function(each,i){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(each)._subtreeNeedsAliasing(); -if($core.assert($1)){ -threshold=i; -return threshold; -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["withIndexDo:"]=1; -//>>excludeEnd("ctx"); -result=$recv($OrderedCollection())._new(); -$recv(aCollection)._withIndexDo_((function(each,i){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=result; -$4=$recv(i).__lt_eq(threshold); -if($core.assert($4)){ -$3=self._alias_(each); -} else { -$3=self._visit_(each); -}; -return $recv($2)._add_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$5=result; -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"] -}), -$globals.IRASTTranslator); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "method", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@method"]; -return $1; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "method\x0a\x09^ method", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + function peg$parseunarySend() { + var s0, s1, s2, s3; -$core.addMethod( -$core.method({ -selector: "method:", -protocol: 'accessing', -fn: function (anIRMethod){ -var self=this; -self["@method"]=anIRMethod; -return self; + var key = peg$currPos * 60 + 47, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRMethod"], -source: "method: anIRMethod\x0a\x09method := anIRMethod", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "nextAlias", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -$1=self["@nextAlias"]; -if(($receiver = $1) == null || $receiver.isNil){ -self["@nextAlias"]=(0); -self["@nextAlias"]; -} else { -$1; -}; -self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1)); -$2=$recv(self["@nextAlias"])._asString(); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "+", "asString"] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = peg$parseoperand(); + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parseunaryTail(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c115(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "sequence", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@sequence"]; -return $1; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sequence\x0a\x09^ sequence", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + return s0; + } -$core.addMethod( -$core.method({ -selector: "sequence:", -protocol: 'accessing', -fn: function (anIRSequence){ -var self=this; -self["@sequence"]=anIRSequence; -return self; + function peg$parsebinaryMessage() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSequence"], -source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + var key = peg$currPos * 60 + 48, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@source"]; -return $1; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parsebinarySelector(); + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseunarySend(); + if (s4 === peg$FAILED) { + s4 = peg$parseoperand(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c116(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@source"]=aString; -return self; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + return s0; + } -$core.addMethod( -$core.method({ -selector: "theClass", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@theClass"]; -return $1; + function peg$parsebinaryTail() { + var s0, s1, s2; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "theClass\x0a\x09^ theClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + var key = peg$currPos * 60 + 49, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "theClass:", -protocol: 'accessing', -fn: function (aClass){ -var self=this; -self["@theClass"]=aClass; -return self; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "theClass: aClass\x0a\x09theClass := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = peg$parsebinaryMessage(); + if (s1 !== peg$FAILED) { + s2 = peg$parsebinaryTail(); + if (s2 === peg$FAILED) { + s2 = peg$c41; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c117(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "visitAssignmentNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var left,right,assignment; -function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$4,$2,$5; -right=self._visit_($recv(aNode)._right()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -left=self._visit_($recv(aNode)._left()); -$1=self._sequence(); -$3=$recv($IRAssignment())._new(); -$recv($3)._add_(left); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv($3)._add_(right); -$4=$recv($3)._yourself(); -$2=$4; -$recv($1)._add_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$5=left; -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left", -referencedClasses: ["IRAssignment"], -//>>excludeEnd("ide"); -messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"] -}), -$globals.IRASTTranslator); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "visitBlockNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var closure; -function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} -function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$6,$5,$7,$8,$9; -$1=$recv($IRClosure())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._arguments_($recv(aNode)._parameters()); -$recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext()); -$2=$1; -$3=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$recv($2)._scope_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope:"]=1; -//>>excludeEnd("ctx"); -$4=$recv($1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -closure=$4; -$6=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._temps(); -$recv($5)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$7=$recv($IRTempDeclaration())._new(); -$recv($7)._name_($recv(each)._name()); -$recv($7)._scope_($recv(aNode)._scope()); -$8=$recv($7)._yourself(); -return $recv(closure)._add_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(closure)._add_(self._visit_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$9=closure; -return $9; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure", -referencedClasses: ["IRClosure", "IRTempDeclaration"], -//>>excludeEnd("ide"); -messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"] -}), -$globals.IRASTTranslator); + return s0; + } -$core.addMethod( -$core.method({ -selector: "visitBlockSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} -function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1; -$2=$recv($IRBlockSequence())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=self._withSequence_do_($2,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$3=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -return $recv($3)._ifNotEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$5=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nodes"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5)._allButLast(); -$recv($4)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -$6=self._sequence(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["sequence"]=1; -//>>excludeEnd("ctx"); -$7=self._visitOrAlias_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["visitOrAlias:"]=1; -//>>excludeEnd("ctx"); -return $recv($6)._add_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)}); -//>>excludeEnd("ctx"); -})); -$10=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nodes"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -$8=$recv($9)._isReturnNode(); -if($core.assert($8)){ -return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last())); -} else { -$11=self._sequence(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["sequence"]=2; -//>>excludeEnd("ctx"); -$13=$recv($IRBlockReturn())._new(); -$14=$13; -$17=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nodes"]=4; -//>>excludeEnd("ctx"); -$16=$recv($17)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["last"]=2; -//>>excludeEnd("ctx"); -$15=self._visitOrAlias_($16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["visitOrAlias:"]=2; -//>>excludeEnd("ctx"); -$recv($14)._add_($15); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$18=$recv($13)._yourself(); -$12=$18; -return $recv($11)._add_($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]", -referencedClasses: ["IRBlockSequence", "IRBlockReturn"], -//>>excludeEnd("ide"); -messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"] -}), -$globals.IRASTTranslator); + function peg$parsebinarySend() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "visitCascadeNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var alias,receiver; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$5,$4,$6; -$2=$recv(aNode)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isImmutable(); -if($core.assert($1)){ -receiver=$recv(aNode)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=2; -//>>excludeEnd("ctx"); -receiver; -} else { -alias=self._alias_($recv(aNode)._receiver()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias:"]=1; -//>>excludeEnd("ctx"); -alias; -receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable()); -receiver; -}; -$3=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$recv($3)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._receiver_(receiver); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$5=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5)._allButLast(); -$recv($4)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._sequence())._add_(self._visit_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); -})); -$6=self._alias_($recv($recv(aNode)._nodes())._last()); -return $6; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last", -referencedClasses: ["VariableNode"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"] -}), -$globals.IRASTTranslator); + var key = peg$currPos * 60 + 50, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "visitDynamicArrayNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var array; -function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -array=$recv($IRDynamicArray())._new(); -$recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(array)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=array; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array", -referencedClasses: ["IRDynamicArray"], -//>>excludeEnd("ide"); -messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"] -}), -$globals.IRASTTranslator); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "visitDynamicDictionaryNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var dictionary; -function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -dictionary=$recv($IRDynamicDictionary())._new(); -$recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(dictionary)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=dictionary; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary", -referencedClasses: ["IRDynamicDictionary"], -//>>excludeEnd("ide"); -messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = peg$parseunarySend(); + if (s1 !== peg$FAILED) { + s2 = peg$parsebinaryTail(); + if (s2 === peg$FAILED) { + s2 = peg$c41; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c115(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "visitJSStatementNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRVerbatim())._new(); -$recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself", -referencedClasses: ["IRVerbatim"], -//>>excludeEnd("ide"); -messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"] -}), -$globals.IRASTTranslator); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "visitMethodNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)} -function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} -function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} -function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} -function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29; -$2=$recv($IRMethod())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($2)._source_($recv(self._source())._crlfSanitized()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["source:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._theClass_(self._theClass()); -$recv($2)._arguments_($recv(aNode)._arguments()); -$recv($2)._selector_($recv(aNode)._selector()); -$recv($2)._sendIndexes_($recv(aNode)._sendIndexes()); -$recv($2)._superSends_($recv(aNode)._superSends()); -$recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext()); -$recv($2)._classReferences_($recv(aNode)._classReferences()); -$3=$2; -$4=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$recv($3)._scope_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope:"]=1; -//>>excludeEnd("ctx"); -$5=$recv($2)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$1=$5; -self._method_($1); -$7=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._temps(); -$recv($6)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$8=self._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["method"]=1; -//>>excludeEnd("ctx"); -$10=$recv($IRTempDeclaration())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($10)._name_($recv(each)._name()); -$11=$10; -$12=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["scope"]=3; -//>>excludeEnd("ctx"); -$recv($11)._scope_($12); -$13=$recv($10)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$9=$13; -return $recv($8)._add_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$14=self._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["method"]=2; -//>>excludeEnd("ctx"); -return $recv($14)._add_(self._visit_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$16=$recv(aNode)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=4; -//>>excludeEnd("ctx"); -$15=$recv($16)._hasLocalReturn(); -if(!$core.assert($15)){ -$17=self._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["method"]=3; -//>>excludeEnd("ctx"); -$18=$17; -$20=$recv($IRReturn())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$21=$20; -$23=$recv($IRVariable())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -$recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self")); -$24=$recv($23)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -$22=$24; -$recv($21)._add_($22); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=4; -//>>excludeEnd("ctx"); -$25=$recv($20)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=4; -//>>excludeEnd("ctx"); -$19=$25; -$recv($18)._add_($19); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$27=$recv($IRVerbatim())._new(); -$recv($27)._source_(""); -$28=$recv($27)._yourself(); -$26=$recv($17)._add_($28); -$26; -}; -$29=self._method(); -return $29; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method", -referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"], -//>>excludeEnd("ide"); -messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"] -}), -$globals.IRASTTranslator); + return s0; + } -$core.addMethod( -$core.method({ -selector: "visitOrAlias:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv(aNode)._shouldBeAliased(); -if($core.assert($2)){ -$1=self._alias_(aNode); -} else { -$1=self._visit_(aNode); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"] -}), -$globals.IRASTTranslator); + function peg$parsekeywordMessage() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "visitReturnNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var return_; -function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)} -function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv(aNode)._nonLocalReturn(); -if($core.assert($1)){ -return_=$recv($IRNonLocalReturn())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -} else { -return_=$recv($IRReturn())._new(); -}; -$recv(return_)._scope_($recv(aNode)._scope()); -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(return_)._add_(self._alias_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$2=return_; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return", -referencedClasses: ["IRNonLocalReturn", "IRReturn"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"] -}), -$globals.IRASTTranslator); + var key = peg$currPos * 60 + 51, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "visitSendNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -var send,all,receiver,arguments_; -function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -send=$recv($IRSend())._new(); -$1=send; -$recv($1)._selector_($recv(aNode)._selector()); -$2=$recv($1)._index_($recv(aNode)._index()); -$3=$recv(aNode)._superSend(); -if($core.assert($3)){ -$recv(send)._classSend_($recv(self._theClass())._superclass()); -}; -all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments())); -receiver=$recv(all)._first(); -arguments_=$recv(all)._allButFirst(); -$recv(send)._add_(receiver); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv(arguments_)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(send)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$4=send; -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send", -referencedClasses: ["IRSend"], -//>>excludeEnd("ide"); -messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"] -}), -$globals.IRASTTranslator); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "visitSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$1=self._withSequence_do_($recv($IRSequence())._new(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(aNode)._nodes())._do_((function(each){ -var instruction; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -instruction=self._visitOrAlias_(each); -instruction; -$2=$recv(instruction)._isVariable(); -if(!$core.assert($2)){ -return $recv(self._sequence())._add_(instruction); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]", -referencedClasses: ["IRSequence"], -//>>excludeEnd("ide"); -messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"] -}), -$globals.IRASTTranslator); + s0 = peg$currPos; + s1 = []; + s2 = peg$parsekeywordPair(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsekeywordPair(); + } + } else { + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c118(s1); + } + s0 = s1; -$core.addMethod( -$core.method({ -selector: "visitValueNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRValue())._new(); -$recv($2)._value_($recv(aNode)._value()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself", -referencedClasses: ["IRValue"], -//>>excludeEnd("ide"); -messageSends: ["value:", "new", "value", "yourself"] -}), -$globals.IRASTTranslator); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "visitVariableNode:", -protocol: 'visiting', -fn: function (aNode){ -var self=this; -function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRVariable())._new(); -$recv($2)._variable_($recv(aNode)._binding()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself", -referencedClasses: ["IRVariable"], -//>>excludeEnd("ide"); -messageSends: ["variable:", "new", "binding", "yourself"] -}), -$globals.IRASTTranslator); + return s0; + } -$core.addMethod( -$core.method({ -selector: "withSequence:do:", -protocol: 'accessing', -fn: function (aSequence,aBlock){ -var self=this; -var outerSequence; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -outerSequence=self._sequence(); -self._sequence_(aSequence); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sequence:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -self._sequence_(outerSequence); -return aSequence; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aSequence", "aBlock"], -source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["sequence", "sequence:", "value"] -}), -$globals.IRASTTranslator); + function peg$parsekeywordSend() { + var s0, s1, s2; + var key = peg$currPos * 60 + 52, + cached = peg$cache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRInstruction_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] -}), -$globals.IRInstruction); + s0 = peg$currPos; + s1 = peg$parsebinarySend(); + if (s1 !== peg$FAILED) { + s2 = peg$parsekeywordMessage(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c119(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "add:", -protocol: 'building', -fn: function (anObject){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(anObject)._parent_(self); -$1=$recv(self._instructions())._add_(anObject); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parent:", "add:", "instructions"] -}), -$globals.IRInstruction); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "canBeAssigned", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "canBeAssigned\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + function peg$parsemessage() { + var s0; -$core.addMethod( -$core.method({ -selector: "instructions", -protocol: 'accessing', -fn: function (){ -var self=this; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@instructions"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@instructions"]=$recv($OrderedCollection())._new(); -$1=self["@instructions"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] -}), -$globals.IRInstruction); + var key = peg$currPos * 60 + 53, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isClosure", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isClosure\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + s0 = peg$parsebinaryMessage(); + if (s0 === peg$FAILED) { + s0 = peg$parseunaryMessage(); + if (s0 === peg$FAILED) { + s0 = peg$parsekeywordMessage(); + } + } -$core.addMethod( -$core.method({ -selector: "isInlined", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isInlined\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isLocalReturn", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + function peg$parsecascade() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isLocalReturn\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + var key = peg$currPos * 60 + 54, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isMethod", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isMethod\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + s2 = peg$parsekeywordSend(); + if (s2 === peg$FAILED) { + s2 = peg$parsebinarySend(); + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s6 = peg$c120; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c121); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parsews(); + if (s7 !== peg$FAILED) { + s8 = peg$parsemessage(); + if (s8 !== peg$FAILED) { + peg$reportedPos = s4; + s5 = peg$c122(s8); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parsews(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s6 = peg$c120; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c121); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parsews(); + if (s7 !== peg$FAILED) { + s8 = peg$parsemessage(); + if (s8 !== peg$FAILED) { + peg$reportedPos = s4; + s5 = peg$c122(s8); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } else { + peg$currPos = s4; + s4 = peg$c1; + } + } + } else { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c123(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "isReturn", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isReturn\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isSend", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + function peg$parsejsStatement() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSend\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + var key = peg$currPos * 60 + 55, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "isSequence", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSequence\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c124; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c125); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c126) { + s4 = peg$c126; + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c127); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c128(); + } + s3 = s4; + if (s3 === peg$FAILED) { + if (peg$c129.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c130); } + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c126) { + s4 = peg$c126; + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c127); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s3; + s4 = peg$c128(); + } + s3 = s4; + if (s3 === peg$FAILED) { + if (peg$c129.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c130); } + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s3 = peg$c131; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c132); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c133(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -$core.addMethod( -$core.method({ -selector: "isTempDeclaration", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isTempDeclaration\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + return s0; + } -$core.addMethod( -$core.method({ -selector: "isVariable", -protocol: 'testing', -fn: function (){ -var self=this; -return false; + function peg$parsemethod() { + var s0, s1, s2, s3, s4; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isVariable\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + var key = peg$currPos * 60 + 56, + cached = peg$cache[key]; -$core.addMethod( -$core.method({ -selector: "method", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._parent())._method(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "method\x0a\x09^ self parent method", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["method", "parent"] -}), -$globals.IRInstruction); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "needsBoxingAsReceiver", -protocol: 'testing', -fn: function (){ -var self=this; -return true; + s0 = peg$currPos; + s1 = peg$parsekeywordPattern(); + if (s1 === peg$FAILED) { + s1 = peg$parsebinaryPattern(); + if (s1 === peg$FAILED) { + s1 = peg$parseunaryPattern(); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsews(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesequence(); + if (s3 === peg$FAILED) { + s3 = peg$c41; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsews(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c134(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "needsBoxingAsReceiver\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; -$core.addMethod( -$core.method({ -selector: "parent", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@parent"]; -return $1; + return s0; + } -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "parent\x0a\x09^ parent", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + function peg$parseassociationSend() { + var s0, s1, s2; -$core.addMethod( -$core.method({ -selector: "parent:", -protocol: 'accessing', -fn: function (anIRInstruction){ -var self=this; -self["@parent"]=anIRInstruction; -return self; + var key = peg$currPos * 60 + 57, + cached = peg$cache[key]; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRInstruction); + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } -$core.addMethod( -$core.method({ -selector: "remove", -protocol: 'building', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._parent())._remove_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "remove\x0a\x09self parent remove: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["remove:", "parent"] -}), -$globals.IRInstruction); + s0 = peg$currPos; + s1 = peg$parsebinarySend(); + if (s1 !== peg$FAILED) { + peg$reportedPos = peg$currPos; + s2 = peg$c135(s1); + if (s2) { + s2 = peg$c112; + } else { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c136(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseassociationList() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 60 + 58, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsews(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c51; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsews(); + if (s3 !== peg$FAILED) { + s4 = peg$parseassociationSend(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c89(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseassociations() { + var s0, s1, s2, s3; + + var key = peg$currPos * 60 + 59, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseassociationSend(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseassociationList(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseassociationList(); + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c137(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c1; + } + } else { + peg$currPos = s0; + s0 = peg$c1; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail({ type: "end", description: "end of input" }); + } + + throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + } + } + + return { + SyntaxError: SyntaxError, + parse: parse + }; +})(); +}); +define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Platform-ImportExport'); +$core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport'); +$globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream."; $core.addMethod( $core.method({ -selector: "remove:", -protocol: 'building', -fn: function (anIRInstruction){ +selector: "classNameFor:", +protocol: 'convenience', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._instructions())._remove_(anIRInstruction); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); +var $2,$3,$4,$1; +$2=$recv(aClass)._isMetaclass(); +if($core.assert($2)){ +$3=$recv($recv(aClass)._instanceClass())._name(); +$ctx1.sendIdx["name"]=1; +$1=$recv($3).__comma(" class"); +} else { +$4=$recv(aClass)._isNil(); +if($core.assert($4)){ +$1="nil"; +} else { +$1=$recv(aClass)._name(); +}; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction", +args: ["aClass"], +source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["remove:", "instructions"] +messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"] }), -$globals.IRInstruction); +$globals.AbstractExporter); $core.addMethod( $core.method({ -selector: "replace:with:", -protocol: 'building', -fn: function (anIRInstruction,anotherIRInstruction){ +selector: "exportPackage:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(anotherIRInstruction)._parent_(self); -$1=self._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction", "anotherIRInstruction"], -source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction", +args: ["aPackage", "aStream"], +source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parent:", "at:put:", "instructions", "indexOf:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRInstruction); +$globals.AbstractExporter); $core.addMethod( $core.method({ -selector: "replaceWith:", -protocol: 'building', -fn: function (anIRInstruction){ +selector: "extensionMethodsOfPackage:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var result; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._parent())._replace_with_(self,anIRInstruction); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); +var $1; +result=$recv($OrderedCollection())._new(); +$recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(result)._addAll_($recv(each)._methods()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$1=result; +return $1; +}, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["replace:with:", "parent"] +args: ["aPackage"], +source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result", +referencedClasses: ["OrderedCollection"], +messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"] }), -$globals.IRInstruction); +$globals.AbstractExporter); $core.addMethod( $core.method({ -selector: "scope", +selector: "extensionProtocolsOfPackage:", protocol: 'accessing', -fn: function (){ +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var extensionName,result; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self._parent(); -if(($receiver = $2) == null || $receiver.isNil){ -$1=$2; -} else { -var node; -node=$receiver; -$1=$recv(node)._scope(); +var $1,$2,$3,$4; +$1=$recv(aPackage)._name(); +$ctx1.sendIdx["name"]=1; +extensionName="*".__comma($1); +result=$recv($OrderedCollection())._new(); +$recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){ +return $core.withContext(function($ctx2) { +$2=$recv(a)._name(); +$ctx2.sendIdx["name"]=2; +return $recv($2).__lt($recv(b)._name()); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); +})))._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv([each,$recv(each)._class()])._do_((function(behavior){ +return $core.withContext(function($ctx3) { +$3=$recv($recv(behavior)._protocols())._includes_(extensionName); +if($core.assert($3)){ +return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior)); }; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)}); -//>>excludeEnd("ctx"); +}, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)}); +})); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$ctx1.sendIdx["do:"]=1; +$4=result; +return $4; +}, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "parent", "scope"] +args: ["aPackage"], +source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result", +referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"], +messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"] }), -$globals.IRInstruction); +$globals.AbstractExporter); + +$core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport'); +$globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code."; $core.addMethod( $core.method({ -selector: "on:", -protocol: 'instance creation', -fn: function (aBuilder){ +selector: "chunkEscape:", +protocol: 'convenience', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._builder_(aBuilder); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBuilder"], -source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself", +args: ["aString"], +source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["builder:", "new", "yourself"] +messageSends: ["trimBoth", "replace:with:"] }), -$globals.IRInstruction.klass); - +$globals.ChunkExporter); -$core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "exportCategoryEpilogueOf:on:", +protocol: 'output', +fn: function (aCategory,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(aVisitor)._visitIRAssignment_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)}); -//>>excludeEnd("ctx"); +$recv(aStream)._nextPutAll_(" !"); +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$1=$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self", +args: ["aCategory", "aStream"], +source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRAssignment:"] +messageSends: ["nextPutAll:", "lf"] }), -$globals.IRAssignment); - - +$globals.ChunkExporter); -$core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "exportCategoryPrologueOf:on:", +protocol: 'output', +fn: function (aCategory,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRDynamicArray_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)}); -//>>excludeEnd("ctx"); +var $1,$3,$2; +$1="!".__comma(self._classNameFor_($recv(aCategory)._theClass())); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$ctx1.sendIdx["nextPutAll:"]=1; +$3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!"); +$ctx1.sendIdx[","]=2; +$2=$recv(aStream)._nextPutAll_($3); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self", +args: ["aCategory", "aStream"], +source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRDynamicArray:"] +messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"] }), -$globals.IRDynamicArray); - - +$globals.ChunkExporter); -$core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "exportDefinitionOf:on:", +protocol: 'output', +fn: function (aClass,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRDynamicDictionary_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)}); -//>>excludeEnd("ctx"); +var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12; +$1=self._classNameFor_($recv(aClass)._superclass()); +$ctx1.sendIdx["classNameFor:"]=1; +$recv(aStream)._nextPutAll_($1); +$ctx1.sendIdx["nextPutAll:"]=1; +$3=self._classNameFor_(aClass); +$ctx1.sendIdx["classNameFor:"]=2; +$2=" subclass: #".__comma($3); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($2); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(aStream)._tab(); +$ctx1.sendIdx["tab"]=1; +$4=$recv(aStream)._nextPutAll_("instanceVariableNames: '"); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(each); +$ctx2.sendIdx["nextPutAll:"]=4; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(" "); +$ctx2.sendIdx["nextPutAll:"]=5; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv(aStream)._nextPutAll_("'"); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=2; +$recv(aStream)._tab(); +$6="package: '".__comma($recv(aClass)._category()); +$ctx1.sendIdx[","]=3; +$5=$recv($6).__comma("'!"); +$ctx1.sendIdx[","]=2; +$recv(aStream)._nextPutAll_($5); +$ctx1.sendIdx["nextPutAll:"]=7; +$7=$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=3; +$9=$recv(aClass)._comment(); +$ctx1.sendIdx["comment"]=1; +$8=$recv($9)._notEmpty(); +if($core.assert($8)){ +$11="!".__comma(self._classNameFor_(aClass)); +$ctx1.sendIdx[","]=5; +$10=$recv($11).__comma(" commentStamp!"); +$ctx1.sendIdx[","]=4; +$recv(aStream)._nextPutAll_($10); +$ctx1.sendIdx["nextPutAll:"]=8; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=4; +$recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!")); +$12=$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=5; +$12; +}; +$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self", +args: ["aClass", "aStream"], +source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRDynamicDictionary:"] +messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"] }), -$globals.IRDynamicDictionary); - - +$globals.ChunkExporter); -$core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ +selector: "exportMetaDefinitionOf:on:", +protocol: 'output', +fn: function (aClass,aStream){ var self=this; -var $1; -$1=self["@scope"]; -return $1; - +return $core.withContext(function($ctx1) { +var $3,$2,$1,$5,$4,$6,$7; +$3=$recv(aClass)._class(); +$ctx1.sendIdx["class"]=1; +$2=$recv($3)._instanceVariableNames(); +$ctx1.sendIdx["instanceVariableNames"]=1; +$1=$recv($2)._isEmpty(); +if(!$core.assert($1)){ +$5=$recv(aClass)._class(); +$ctx1.sendIdx["class"]=2; +$4=self._classNameFor_($5); +$recv(aStream)._nextPutAll_($4); +$ctx1.sendIdx["nextPutAll:"]=1; +$6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '"); +$ctx1.sendIdx["nextPutAll:"]=2; +$6; +$recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(each); +$ctx2.sendIdx["nextPutAll:"]=3; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(" "); +$ctx2.sendIdx["nextPutAll:"]=4; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$recv(aStream)._nextPutAll_("'!"); +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$7=$recv(aStream)._lf(); +$7; +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope", +args: ["aClass", "aStream"], +source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"] }), -$globals.IRScopedInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aScope){ +selector: "exportMethod:on:", +protocol: 'output', +fn: function (aMethod,aStream){ var self=this; -self["@scope"]=aScope; +return $core.withContext(function($ctx1) { +var $1; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=2; +$recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source())); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aStream)._lf(); +$1=$recv(aStream)._nextPutAll_("!"); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "scope: aScope\x0a\x09scope := aScope", +args: ["aMethod", "aStream"], +source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"] }), -$globals.IRScopedInstruction); - - +$globals.ChunkExporter); -$core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "arguments", -protocol: 'accessing', -fn: function (){ +selector: "exportPackage:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@arguments"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=[]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)}); -//>>excludeEnd("ctx"); +var $1,$2; +self._exportPackageDefinitionOf_on_(aPackage,aStream); +$1=self._exportPackageImportsOf_on_(aPackage,aStream); +$recv($recv(aPackage)._sortedClasses())._do_((function(each){ +return $core.withContext(function($ctx2) { +self._exportDefinitionOf_on_(each,aStream); +$2=self._ownMethodProtocolsOfClass_(each); +$ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1; +self._exportProtocols_on_($2,aStream); +$ctx2.sendIdx["exportProtocols:on:"]=1; +self._exportMetaDefinitionOf_on_(each,aStream); +return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream); +$ctx2.sendIdx["exportProtocols:on:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "arguments\x0a\x09^ arguments ifNil: [ #() ]", +args: ["aPackage", "aStream"], +source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] +messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "arguments:", -protocol: 'accessing', -fn: function (aCollection){ +selector: "exportPackageDefinitionOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -self["@arguments"]=aCollection; +return $core.withContext(function($ctx1) { +var $1,$2; +$1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!"); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$2=$recv(aStream)._lf(); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "arguments: aCollection\x0a\x09arguments := aCollection", +args: ["aPackage", "aStream"], +source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", ",", "name", "lf"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "locals", -protocol: 'accessing', -fn: function (){ +selector: "exportPackageImportsOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv(self._arguments())._copy(); -$recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))); -$3=$recv($2)._yourself(); -$1=$3; +$recv(aStream)._nextPutAll_("(Smalltalk packageAt: '"); +$ctx2.sendIdx["nextPutAll:"]=1; +$recv(aStream)._nextPutAll_($recv(aPackage)._name()); +$ctx2.sendIdx["nextPutAll:"]=2; +$recv(aStream)._nextPutAll_("') imports: "); +$ctx2.sendIdx["nextPutAll:"]=3; +$recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition())); +$ctx2.sendIdx["nextPutAll:"]=4; +$recv(aStream)._nextPutAll_("!"); +$1=$recv(aStream)._lf(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)}); -//>>excludeEnd("ctx"); +}, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself", +args: ["aPackage", "aStream"], +source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"] +messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "requiresSmalltalkContext", -protocol: 'accessing', -fn: function (){ +selector: "exportProtocol:on:", +protocol: 'output', +fn: function (aProtocol,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@requiresSmalltalkContext"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=false; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)}); -//>>excludeEnd("ctx"); +self._exportProtocolPrologueOf_on_(aProtocol,aStream); +$recv($recv(aProtocol)._methods())._do_((function(method){ +return $core.withContext(function($ctx2) { +return self._exportMethod_on_(method,aStream); +}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)}); +})); +self._exportProtocolEpilogueOf_on_(aProtocol,aStream); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]", +args: ["aProtocol", "aStream"], +source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] +messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "requiresSmalltalkContext:", -protocol: 'accessing', -fn: function (anObject){ +selector: "exportProtocolEpilogueOf:on:", +protocol: 'output', +fn: function (aProtocol,aStream){ var self=this; -self["@requiresSmalltalkContext"]=anObject; +return $core.withContext(function($ctx1) { +var $1; +$recv(aStream)._nextPutAll_(" !"); +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$1=$recv(aStream)._lf(); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject", +args: ["aProtocol", "aStream"], +source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", "lf"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "scope:", -protocol: 'accessing', -fn: function (aScope){ +selector: "exportProtocolPrologueOf:on:", +protocol: 'output', +fn: function (aProtocol,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aScope)._instruction_(self); +var $1,$3,$2; +$1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass())); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$ctx1.sendIdx["nextPutAll:"]=1; +$3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!"); +$ctx1.sendIdx[","]=2; +$2=$recv(aStream)._nextPutAll_($3); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self", +args: ["aProtocol", "aStream"], +source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["scope:", "instruction:"] +messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"] }), -$globals.IRClosureInstruction); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "tempDeclarations", -protocol: 'accessing', -fn: function (){ +selector: "exportProtocols:on:", +protocol: 'output', +fn: function (aCollection,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._instructions())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv(aCollection)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._isTempDeclaration(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._exportProtocol_on_(each,aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)}); -//>>excludeEnd("ctx"); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]", +args: ["aCollection", "aStream"], +source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["select:", "instructions", "isTempDeclaration"] +messageSends: ["do:", "exportProtocol:on:"] }), -$globals.IRClosureInstruction); - - +$globals.ChunkExporter); -$core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "extensionCategoriesOfPackage:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var name,map,result; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} +function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRClosure_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRClosure:"] -}), -$globals.IRClosure); - -$core.addMethod( -$core.method({ -selector: "isClosure", -protocol: 'testing', -fn: function (){ -var self=this; -return true; - +var $1,$2; +name=$recv(aPackage)._name(); +result=$recv($OrderedCollection())._new(); +$ctx1.sendIdx["new"]=1; +$recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv([each,$recv(each)._class()])._do_((function(aClass){ +return $core.withContext(function($ctx3) { +map=$recv($Dictionary())._new(); +map; +$recv(aClass)._protocolsDo_((function(category,methods){ +return $core.withContext(function($ctx4) { +$1=$recv(category).__eq("*".__comma(name)); +if($core.assert($1)){ +return $recv(map)._at_put_(category,methods); +}; +}, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)}); +})); +return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){ +return $core.withContext(function($ctx4) { +return $recv(a).__lt_eq(b); +}, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)}); +})))._collect_((function(category){ +return $core.withContext(function($ctx4) { +return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category)); +}, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)}); +}))); +}, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +$2=result; +return $2; +}, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isClosure\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aPackage"], +source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result", +referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"], +messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"] }), -$globals.IRClosure); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "sequence", +selector: "ownCategoriesOfClass:", protocol: 'accessing', -fn: function (){ +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var map; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._instructions())._last(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)}); -//>>excludeEnd("ctx"); +var $1,$2; +map=$recv($Dictionary())._new(); +$recv(aClass)._protocolsDo_((function(each,methods){ +return $core.withContext(function($ctx2) { +$1=$recv(each)._match_("^\x5c*"); +if(!$core.assert($1)){ +return $recv(map)._at_put_(each,methods); +}; +}, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)}); +})); +$2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){ +return $core.withContext(function($ctx2) { +return $recv(a).__lt_eq(b); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)}); +})))._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); +})); +return $2; +}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sequence\x0a\x09^ self instructions last", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["last", "instructions"] +args: ["aClass"], +source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]", +referencedClasses: ["Dictionary", "MethodCategory"], +messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"] }), -$globals.IRClosure); - - +$globals.ChunkExporter); -$core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRMethod.comment="I am a method instruction"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "ownCategoriesOfMetaClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(aVisitor)._visitIRMethod_(self); +$1=self._ownCategoriesOfClass_($recv(aClass)._class()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self", +args: ["aClass"], +source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRMethod:"] +messageSends: ["ownCategoriesOfClass:", "class"] }), -$globals.IRMethod); +$globals.ChunkExporter); $core.addMethod( $core.method({ -selector: "classReferences", +selector: "ownMethodProtocolsOfClass:", protocol: 'accessing', -fn: function (){ +fn: function (aClass){ var self=this; +function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)} +return $core.withContext(function($ctx1) { var $1; -$1=self["@classReferences"]; +$1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv($ExportMethodProtocol())._name_theClass_(each,aClass); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); return $1; - +}, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "classReferences\x0a\x09^ classReferences", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aClass"], +source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]", +referencedClasses: ["ExportMethodProtocol"], +messageSends: ["collect:", "ownProtocols", "name:theClass:"] }), -$globals.IRMethod); +$globals.ChunkExporter); -$core.addMethod( -$core.method({ -selector: "classReferences:", -protocol: 'accessing', -fn: function (aCollection){ -var self=this; -self["@classReferences"]=aCollection; -return self; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "classReferences: aCollection\x0a\x09classReferences := aCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRMethod); +$core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport'); +$globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.)."; $core.addMethod( $core.method({ -selector: "internalVariables", -protocol: 'accessing', -fn: function (){ +selector: "exportDefinitionOf:on:", +protocol: 'output', +fn: function (aClass,aStream){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@internalVariables"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@internalVariables"]=$recv($Set())._new(); -$1=self["@internalVariables"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] -}), -$globals.IRMethod); - -$core.addMethod( -$core.method({ -selector: "isMethod", -protocol: 'accessing', -fn: function (){ -var self=this; -return true; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isMethod\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRMethod); - -$core.addMethod( -$core.method({ -selector: "messageSends", -protocol: 'accessing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._sendIndexes())._keys(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)}); -//>>excludeEnd("ctx"); +var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(aStream)._nextPutAll_("$core.addClass("); +$ctx1.sendIdx["nextPutAll:"]=1; +$2="'".__comma(self._classNameFor_(aClass)); +$ctx1.sendIdx[","]=2; +$1=$recv($2).__comma("', "); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$ctx1.sendIdx["nextPutAll:"]=2; +$3=self._jsClassNameFor_($recv(aClass)._superclass()); +$ctx1.sendIdx["jsClassNameFor:"]=1; +$recv(aStream)._nextPutAll_($3); +$ctx1.sendIdx["nextPutAll:"]=3; +$4=$recv(aStream)._nextPutAll_(", ["); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +$6="'".__comma(each); +$ctx2.sendIdx[","]=4; +$5=$recv($6).__comma("'"); +$ctx2.sendIdx[","]=3; +return $recv(aStream)._nextPutAll_($5); +$ctx2.sendIdx["nextPutAll:"]=5; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(", "); +$ctx2.sendIdx["nextPutAll:"]=6; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv(aStream)._nextPutAll_("], '"); +$ctx1.sendIdx["nextPutAll:"]=7; +$recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'")); +$ctx1.sendIdx["nextPutAll:"]=8; +$7=$recv(aStream)._nextPutAll_(");"); +$ctx1.sendIdx["nextPutAll:"]=9; +$9=$recv(aClass)._comment(); +$ctx1.sendIdx["comment"]=1; +$8=$recv($9)._notEmpty(); +if($core.assert($8)){ +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=2; +$recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);"); +$ctx1.sendIdx["nextPutAll:"]=10; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=3; +$recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass)); +$ctx1.sendIdx["nextPutAll:"]=11; +$recv(aStream)._nextPutAll_(".comment="); +$ctx1.sendIdx["nextPutAll:"]=12; +$recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=13; +$recv(aStream)._nextPutAll_(";"); +$ctx1.sendIdx["nextPutAll:"]=14; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=4; +$10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);"); +$10; +}; +$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "messageSends\x0a\x09^ self sendIndexes keys", +args: ["aClass", "aStream"], +source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["keys", "sendIndexes"] +messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "method", -protocol: 'accessing', -fn: function (){ +selector: "exportMetaDefinitionOf:on:", +protocol: 'output', +fn: function (aClass,aStream){ var self=this; +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $core.withContext(function($ctx1) { +var $3,$2,$1,$5,$4,$6,$8,$7; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$3=$recv(aClass)._class(); +$ctx1.sendIdx["class"]=1; +$2=$recv($3)._instanceVariableNames(); +$ctx1.sendIdx["instanceVariableNames"]=1; +$1=$recv($2)._isEmpty(); +if(!$core.assert($1)){ +$5=$recv(aClass)._class(); +$ctx1.sendIdx["class"]=2; +$4=self._jsClassNameFor_($5); +$recv(aStream)._nextPutAll_($4); +$ctx1.sendIdx["nextPutAll:"]=1; +$6=$recv(aStream)._nextPutAll_(".iVarNames = ["); +$ctx1.sendIdx["nextPutAll:"]=2; +$6; +$recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +$8="'".__comma(each); +$ctx2.sendIdx[","]=2; +$7=$recv($8).__comma("'"); +$ctx2.sendIdx[","]=1; +return $recv(aStream)._nextPutAll_($7); +$ctx2.sendIdx["nextPutAll:"]=3; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(aStream)._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=4; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf())); +}; return self; - +}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "method\x0a\x09^ self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aClass", "aStream"], +source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]", +referencedClasses: ["String"], +messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "selector", -protocol: 'accessing', -fn: function (){ +selector: "exportMethod:on:", +protocol: 'output', +fn: function (aMethod,aStream){ var self=this; -var $1; -$1=self["@selector"]; -return $1; - +return $core.withContext(function($ctx1) { +var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17; +$recv(aStream)._nextPutAll_("$core.addMethod("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(aStream)._nextPutAll_("$core.method({"); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=2; +$3=$recv($recv(aMethod)._selector())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=1; +$2="selector: ".__comma($3); +$ctx1.sendIdx[","]=2; +$1=$recv($2).__comma(","); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=3; +$5="protocol: '".__comma($recv(aMethod)._protocol()); +$ctx1.sendIdx[","]=4; +$4=$recv($5).__comma("',"); +$ctx1.sendIdx[","]=3; +$recv(aStream)._nextPutAll_($4); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=4; +$7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource()); +$ctx1.sendIdx[","]=6; +$6=$recv($7).__comma(","); +$ctx1.sendIdx[","]=5; +$recv(aStream)._nextPutAll_($6); +$ctx1.sendIdx["nextPutAll:"]=5; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=5; +$recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);"); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=6; +$10=$recv($recv(aMethod)._arguments())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=2; +$9="args: ".__comma($10); +$ctx1.sendIdx[","]=8; +$8=$recv($9).__comma(","); +$ctx1.sendIdx[","]=7; +$recv(aStream)._nextPutAll_($8); +$ctx1.sendIdx["nextPutAll:"]=7; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=7; +$13=$recv($recv(aMethod)._source())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=3; +$12="source: ".__comma($13); +$ctx1.sendIdx[","]=10; +$11=$recv($12).__comma(","); +$ctx1.sendIdx[","]=9; +$recv(aStream)._nextPutAll_($11); +$ctx1.sendIdx["nextPutAll:"]=8; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=8; +$16=$recv($recv(aMethod)._referencedClasses())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=4; +$15="referencedClasses: ".__comma($16); +$ctx1.sendIdx[","]=12; +$14=$recv($15).__comma(","); +$ctx1.sendIdx[","]=11; +$recv(aStream)._nextPutAll_($14); +$ctx1.sendIdx["nextPutAll:"]=9; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=9; +$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);"); +$ctx1.sendIdx["nextPutAll:"]=10; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=10; +$recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript())); +$ctx1.sendIdx["nextPutAll:"]=11; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=11; +$recv(aStream)._nextPutAll_("}),"); +$ctx1.sendIdx["nextPutAll:"]=12; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=12; +$recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass())); +$ctx1.sendIdx["nextPutAll:"]=13; +$recv(aStream)._nextPutAll_(");"); +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=13; +$17=$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "selector\x0a\x09^ selector", +args: ["aMethod", "aStream"], +source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "selector:", -protocol: 'accessing', -fn: function (aString){ +selector: "exportPackage:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -self["@selector"]=aString; +return $core.withContext(function($ctx1) { +var $1,$2; +self._exportPackagePrologueOf_on_(aPackage,aStream); +self._exportPackageDefinitionOf_on_(aPackage,aStream); +self._exportPackageContextOf_on_(aPackage,aStream); +self._exportPackageImportsOf_on_(aPackage,aStream); +$1=self._exportPackageTransportOf_on_(aPackage,aStream); +$recv($recv(aPackage)._sortedClasses())._do_((function(each){ +return $core.withContext(function($ctx2) { +self._exportDefinitionOf_on_(each,aStream); +$2=$recv(each)._ownMethods(); +$ctx2.sendIdx["ownMethods"]=1; +$recv($2)._do_((function(method){ +return $core.withContext(function($ctx3) { +return self._exportMethod_on_(method,aStream); +$ctx3.sendIdx["exportMethod:on:"]=1; +}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)}); +})); +$ctx2.sendIdx["do:"]=2; +self._exportMetaDefinitionOf_on_(each,aStream); +return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){ +return $core.withContext(function($ctx3) { +return self._exportMethod_on_(method,aStream); +$ctx3.sendIdx["exportMethod:on:"]=2; +}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)}); +})); +$ctx2.sendIdx["do:"]=3; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +$recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){ +return $core.withContext(function($ctx2) { +return self._exportMethod_on_(each,aStream); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); +})); +self._exportPackageEpilogueOf_on_(aPackage,aStream); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", +args: ["aPackage", "aStream"], +source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "sendIndexes", -protocol: 'accessing', -fn: function (){ +selector: "exportPackageContextOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@sendIndexes"]; -return $1; - +$recv(aStream)._nextPutAll_("$core.packages["); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv(aStream)._nextPutAll_("].innerEval = "); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }"); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv(aStream)._nextPutAll_(";"); +$1=$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sendIndexes\x0a\x09^ sendIndexes", +args: ["aPackage", "aStream"], +source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", "asJavascript", "name", "lf"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "sendIndexes:", -protocol: 'accessing', -fn: function (aDictionary){ +selector: "exportPackageDefinitionOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -self["@sendIndexes"]=aDictionary; +return $core.withContext(function($ctx1) { +var $1,$2; +$recv(aStream)._nextPutAll_("$core.addPackage("); +$ctx1.sendIdx["nextPutAll:"]=1; +$1=$recv("'".__comma($recv(aPackage)._name())).__comma("');"); +$ctx1.sendIdx[","]=1; +$recv(aStream)._nextPutAll_($1); +$2=$recv(aStream)._lf(); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aDictionary"], -source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", +args: ["aPackage", "aStream"], +source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", ",", "name", "lf"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ +selector: "exportPackageEpilogueOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -var $1; -$1=self["@source"]; -return $1; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source", +args: ["aPackage", "aStream"], +source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "source:", -protocol: 'accessing', -fn: function (aString){ +selector: "exportPackageImportsOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -self["@source"]=aString; +return $core.withContext(function($ctx1) { +var $1,$2; +$recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){ +return $core.withContext(function($ctx2) { +$recv(aStream)._nextPutAll_("$core.packages["); +$ctx2.sendIdx["nextPutAll:"]=1; +$1=$recv($recv(aPackage)._name())._asJavascript(); +$ctx2.sendIdx["asJavascript"]=1; +$recv(aStream)._nextPutAll_($1); +$ctx2.sendIdx["nextPutAll:"]=2; +$recv(aStream)._nextPutAll_("].imports = "); +$ctx2.sendIdx["nextPutAll:"]=3; +$recv(aStream)._nextPutAll_($recv(imports)._asJavascript()); +$ctx2.sendIdx["nextPutAll:"]=4; +$recv(aStream)._nextPutAll_(";"); +$2=$recv(aStream)._lf(); +return $2; +}, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)}); +})); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", +args: ["aPackage", "aStream"], +source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "superSends", -protocol: 'accessing', -fn: function (){ +selector: "exportPackagePrologueOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -var $1; -$1=self["@superSends"]; -return $1; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "superSends\x0a\x09^ superSends", +args: ["aPackage", "aStream"], +source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "superSends:", -protocol: 'accessing', -fn: function (aCollection){ +selector: "exportPackageTransportOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -self["@superSends"]=aCollection; +return $core.withContext(function($ctx1) { +var $1; +$recv(aStream)._nextPutAll_("$core.packages["); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv(aStream)._nextPutAll_("].transport = "); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString()); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv(aStream)._nextPutAll_(";"); +$1=$recv(aStream)._lf(); return self; - +}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "superSends: aCollection\x0a\x09superSends := aCollection", +args: ["aPackage", "aStream"], +source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "theClass", -protocol: 'accessing', -fn: function (){ +selector: "jsClassNameFor:", +protocol: 'convenience', +fn: function (aClass){ var self=this; -var $1; -$1=self["@theClass"]; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=$recv(aClass)._isMetaclass(); +if($core.assert($2)){ +$1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass"); +$ctx1.sendIdx[","]=1; +} else { +if(($receiver = aClass) == null || $receiver.isNil){ +$1="null"; +} else { +$1="$globals.".__comma($recv(aClass)._name()); +}; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "theClass\x0a\x09^ theClass", +args: ["aClass"], +source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"] }), -$globals.IRMethod); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "theClass:", +selector: "ownMethodsOfClass:", protocol: 'accessing', fn: function (aClass){ var self=this; -self["@theClass"]=aClass; -return self; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "theClass: aClass\x0a\x09theClass := aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRMethod); - - - -$core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRReturn.comment="I am a local return instruction."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRReturn_(self); +var $2,$1; +$1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){ +return $core.withContext(function($ctx2) { +$2=$recv(a)._selector(); +$ctx2.sendIdx["selector"]=1; +return $recv($2).__lt_eq($recv(b)._selector()); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); +})))._reject_((function(each){ +return $core.withContext(function($ctx2) { +return $recv($recv(each)._protocol())._match_("^\x5c*"); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self", +args: ["aClass"], +source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRReturn:"] +messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"] }), -$globals.IRReturn); +$globals.Exporter); $core.addMethod( $core.method({ -selector: "canBeAssigned", -protocol: 'testing', -fn: function (){ +selector: "ownMethodsOfMetaClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +var $1; +$1=self._ownMethodsOfClass_($recv(aClass)._class()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "canBeAssigned\x0a\x09^ false", +args: ["aClass"], +source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ownMethodsOfClass:", "class"] }), -$globals.IRReturn); +$globals.Exporter); + + +$core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport'); +$globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format."; $core.addMethod( $core.method({ -selector: "isBlockReturn", -protocol: 'testing', -fn: function (){ +selector: "amdNamesOfPackages:", +protocol: 'private', +fn: function (anArray){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +var $2,$1; +$1=$recv($recv(anArray)._select_((function(each){ +return $core.withContext(function($ctx2) { +$2=self._amdNamespaceOfPackage_(each); +$ctx2.sendIdx["amdNamespaceOfPackage:"]=1; +return $recv($2)._notNil(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})))._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name()); +$ctx2.sendIdx[","]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isBlockReturn\x0a\x09^ false", +args: ["anArray"], +source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"] }), -$globals.IRReturn); +$globals.AmdExporter); $core.addMethod( $core.method({ -selector: "isLocalReturn", -protocol: 'testing', -fn: function (){ +selector: "amdNamespaceOfPackage:", +protocol: 'private', +fn: function (aPackage){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $4,$3,$2,$1; +$4=$recv(aPackage)._transport(); +$ctx1.sendIdx["transport"]=1; +$3=$recv($4)._type(); +$2=$recv($3).__eq("amd"); +if($core.assert($2)){ +$1=$recv($recv(aPackage)._transport())._namespace(); +} else { +$1=nil; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isLocalReturn\x0a\x09^ true", +args: ["aPackage"], +source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"] }), -$globals.IRReturn); +$globals.AmdExporter); $core.addMethod( $core.method({ -selector: "isNonLocalReturn", -protocol: 'testing', -fn: function (){ +selector: "exportPackageEpilogueOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._isLocalReturn())._not(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)}); -//>>excludeEnd("ctx"); +$recv(aStream)._nextPutAll_("});"); +$1=$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not", +args: ["aPackage", "aStream"], +source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["not", "isLocalReturn"] +messageSends: ["nextPutAll:", "lf"] }), -$globals.IRReturn); +$globals.AmdExporter); $core.addMethod( $core.method({ -selector: "isReturn", -protocol: 'testing', -fn: function (){ +selector: "exportPackagePrologueOf:on:", +protocol: 'output', +fn: function (aPackage,aStream){ var self=this; -return true; - +var importsForOutput,loadDependencies,pragmaStart,pragmaEnd; +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $core.withContext(function($ctx1) { +var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18; +pragmaStart=""; +pragmaEnd=""; +importsForOutput=self._importsForOutput_(aPackage); +loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies()); +$1=$recv(importsForOutput)._value(); +$ctx1.sendIdx["value"]=1; +$recv($1)._ifNotEmpty_((function(){ +return $core.withContext(function($ctx2) { +$3=$recv($String())._lf(); +$ctx2.sendIdx["lf"]=1; +$2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);"); +$ctx2.sendIdx[","]=2; +$4=$recv($String())._lf(); +$ctx2.sendIdx["lf"]=2; +pragmaStart=$recv($2).__comma($4); +$ctx2.sendIdx[","]=1; +pragmaStart; +$6=$recv($String())._lf(); +$ctx2.sendIdx["lf"]=3; +$5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);"); +$ctx2.sendIdx[","]=4; +$7=$recv($String())._lf(); +$ctx2.sendIdx["lf"]=4; +pragmaEnd=$recv($5).__comma($7); +$ctx2.sendIdx[","]=3; +return pragmaEnd; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$recv(aStream)._nextPutAll_("define(\x22"); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage)); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv(aStream)._nextPutAll_("/"); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv(aStream)._nextPutAll_($recv(aPackage)._name()); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv(aStream)._nextPutAll_("\x22, "); +$ctx1.sendIdx["nextPutAll:"]=5; +$13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value()); +$ctx1.sendIdx[","]=7; +$12=$recv($13).__comma([":2:"]); +$ctx1.sendIdx[","]=6; +$11=$recv($12).__comma(loadDependencies); +$ctx1.sendIdx[","]=5; +$10=$recv($11)._asJavascript(); +$9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart); +$ctx1.sendIdx["replace:with:"]=2; +$8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd); +$ctx1.sendIdx["replace:with:"]=1; +$recv(aStream)._nextPutAll_($8); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv(aStream)._nextPutAll_(", function("); +$ctx1.sendIdx["nextPutAll:"]=7; +$17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]); +$ctx1.sendIdx[","]=8; +$16=$recv($17)._join_(","); +$15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart); +$14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd); +$ctx1.sendIdx["replace:with:"]=3; +$recv(aStream)._nextPutAll_($14); +$ctx1.sendIdx["nextPutAll:"]=8; +$recv(aStream)._nextPutAll_("){\x22use strict\x22;"); +$ctx1.sendIdx["nextPutAll:"]=9; +$recv(aStream)._lf(); +$ctx1.sendIdx["lf"]=5; +$recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;"); +$18=$recv(aStream)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isReturn\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aPackage", "aStream"], +source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){\x22use strict\x22;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf", +referencedClasses: ["String"], +messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"] }), -$globals.IRReturn); +$globals.AmdExporter); $core.addMethod( $core.method({ -selector: "scope", -protocol: 'accessing', -fn: function (){ +selector: "importsForOutput:", +protocol: 'private', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var namedImports,anonImports,importVarNames; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@scope"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=$recv(self._parent())._scope(); +var $1,$2; +namedImports=[]; +anonImports=[]; +importVarNames=[]; +$recv($recv(aPackage)._imports())._do_((function(each){ +return $core.withContext(function($ctx2) { +$1=$recv(each)._isString(); +if($core.assert($1)){ +return $recv(anonImports)._add_(each); +$ctx2.sendIdx["add:"]=1; } else { -$1=$2; +$recv(namedImports)._add_($recv(each)._value()); +$ctx2.sendIdx["add:"]=2; +return $recv(importVarNames)._add_($recv(each)._key()); }; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)}); -//>>excludeEnd("ctx"); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports)); +return $2; +}, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]", +args: ["aPackage"], +source: "importsForOutput: aPackage\x0a\x09\x22Returns an association where key is list of import variables\x0a\x09and value is list of external dependencies, with ones imported as variables\x0a\x09put at the beginning with same order as is in key.\x0a\x09\x0a\x09For example imports:{'jQuery'->'jquery'. 'bootstrap'} would yield\x0a\x09#('jQuery') -> #('jquery' 'bootstrap')\x22\x0a\x09| namedImports anonImports importVarNames |\x0a\x09namedImports := #().\x0a\x09anonImports := #().\x0a\x09importVarNames := #().\x0a\x09aPackage imports do: [ :each | each isString\x0a\x09\x09ifTrue: [ anonImports add: each ]\x0a\x09\x09ifFalse: [ namedImports add: each value.\x0a\x09\x09\x09importVarNames add: each key ]].\x0a\x09^ importVarNames -> (namedImports, anonImports)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "scope", "parent"] +messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","] }), -$globals.IRReturn); +$globals.AmdExporter); -$core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction."; -//>>excludeEnd("ide"); +$core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport'); +$globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk"; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "last", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(aVisitor)._visitIRBlockReturn_(self); +$1=self["@last"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRBlockReturn:"] -}), -$globals.IRBlockReturn); - -$core.addMethod( -$core.method({ -selector: "isBlockReturn", -protocol: 'testing', -fn: function (){ -var self=this; -return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isBlockReturn\x0a\x09^ true", +source: "last\x0a\x09^ last", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRBlockReturn); - - +$globals.ChunkParser); -$core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "nextChunk", +protocol: 'reading', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var char,result,chunk; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRNonLocalReturn_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)}); -//>>excludeEnd("ctx"); +var $1,$2,$3,$4; +var $early={}; +try { +result=""._writeStream(); +$recv((function(){ +return $core.withContext(function($ctx2) { +char=$recv(self["@stream"])._next(); +$ctx2.sendIdx["next"]=1; +char; +return $recv(char)._notNil(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileTrue_((function(){ +return $core.withContext(function($ctx2) { +$1=$recv(char).__eq("!"); +$ctx2.sendIdx["="]=1; +if($core.assert($1)){ +$2=$recv($recv(self["@stream"])._peek()).__eq("!"); +if($core.assert($2)){ +$recv(self["@stream"])._next(); +} else { +self["@last"]=$recv($recv(result)._contents())._trimBoth(); +$3=self["@last"]; +throw $early=[$3]; +}; +}; +return $recv(result)._nextPut_(char); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +self["@last"]=nil; +$4=self["@last"]; +return $4; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self", +args: [], +source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRNonLocalReturn:"] +messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"] }), -$globals.IRNonLocalReturn); +$globals.ChunkParser); $core.addMethod( $core.method({ -selector: "isLocalReturn", -protocol: 'testing', -fn: function (){ +selector: "stream:", +protocol: 'accessing', +fn: function (aStream){ var self=this; -return false; +self["@stream"]=aStream; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isLocalReturn\x0a\x09^ false", +args: ["aStream"], +source: "stream: aStream\x0a\x09stream := aStream", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRNonLocalReturn); - +$globals.ChunkParser); -$core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "on:", +protocol: 'instance creation', +fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(aVisitor)._visitIRTempDeclaration_(self); +$1=$recv(self._new())._stream_(aStream); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self", +args: ["aStream"], +source: "on: aStream\x0a\x09^ self new stream: aStream", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRTempDeclaration:"] +messageSends: ["stream:", "new"] }), -$globals.IRTempDeclaration); +$globals.ChunkParser.klass); + +$core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport'); +$globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`."; $core.addMethod( $core.method({ -selector: "isTempDeclaration", -protocol: 'testing', -fn: function (){ +selector: "class:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -return true; +self["@class"]=aClass; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isTempDeclaration\x0a\x09^ true", +args: ["aClass"], +source: "class: aClass\x0a\x09class := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRTempDeclaration); +$globals.ClassCommentReader); $core.addMethod( $core.method({ -selector: "name", -protocol: 'accessing', +selector: "initialize", +protocol: 'initialization', fn: function (){ var self=this; -var $1; -$1=self["@name"]; -return $1; - +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +return self; +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "name\x0a\x09^ name", +source: "initialize\x0a\x09super initialize.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["initialize"] }), -$globals.IRTempDeclaration); +$globals.ClassCommentReader); $core.addMethod( $core.method({ -selector: "name:", -protocol: 'accessing', -fn: function (aString){ +selector: "scanFrom:", +protocol: 'fileIn', +fn: function (aChunkParser){ var self=this; -self["@name"]=aString; +var chunk; +return $core.withContext(function($ctx1) { +var $1; +chunk=$recv(aChunkParser)._nextChunk(); +$1=$recv(chunk)._isEmpty(); +if(!$core.assert($1)){ +self._setComment_(chunk); +}; return self; - +}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "name: aString\x0a\x09name := aString", +args: ["aChunkParser"], +source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"] }), -$globals.IRTempDeclaration); - - +$globals.ClassCommentReader); -$core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRSend.comment="I am a message send instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "setComment:", +protocol: 'private', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRSend_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)}); -//>>excludeEnd("ctx"); +$recv(self["@class"])._comment_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self", +args: ["aString"], +source: "setComment: aString\x0a\x09class comment: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRSend:"] +messageSends: ["comment:"] }), -$globals.IRSend); +$globals.ClassCommentReader); -$core.addMethod( -$core.method({ -selector: "classSend", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@classSend"]; -return $1; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "classSend\x0a\x09^ classSend", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRSend); +$core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport'); +$globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format."; $core.addMethod( $core.method({ -selector: "classSend:", +selector: "class:category:", protocol: 'accessing', -fn: function (aClass){ +fn: function (aClass,aString){ var self=this; -self["@classSend"]=aClass; +self["@class"]=aClass; +self["@category"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "classSend: aClass\x0a\x09classSend := aClass", +args: ["aClass", "aString"], +source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRSend); +$globals.ClassProtocolReader); $core.addMethod( $core.method({ -selector: "index", -protocol: 'accessing', -fn: function (){ +selector: "compileMethod:", +protocol: 'private', +fn: function (aString){ var self=this; -var $1; -$1=self["@index"]; -return $1; +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} +return $core.withContext(function($ctx1) { +$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]); +return self; +}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)}); +}, +args: ["aString"], +source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category", +referencedClasses: ["Compiler"], +messageSends: ["install:forClass:protocol:", "new"] +}), +$globals.ClassProtocolReader); +$core.addMethod( +$core.method({ +selector: "initialize", +protocol: 'initialization', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +return self; +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "index\x0a\x09^ index", +source: "initialize\x0a\x09super initialize.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["initialize"] }), -$globals.IRSend); +$globals.ClassProtocolReader); $core.addMethod( $core.method({ -selector: "index:", -protocol: 'accessing', -fn: function (anInteger){ +selector: "scanFrom:", +protocol: 'fileIn', +fn: function (aChunkParser){ var self=this; -self["@index"]=anInteger; +var chunk; +function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} +return $core.withContext(function($ctx1) { +$recv((function(){ +return $core.withContext(function($ctx2) { +chunk=$recv(aChunkParser)._nextChunk(); +chunk; +return $recv(chunk)._isEmpty(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileFalse_((function(){ +return $core.withContext(function($ctx2) { +return self._compileMethod_(chunk); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]); return self; - +}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInteger"], -source: "index: anInteger\x0a\x09index := anInteger", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aChunkParser"], +source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class", +referencedClasses: ["ClassBuilder"], +messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"] }), -$globals.IRSend); +$globals.ClassProtocolReader); + + +$core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport'); +$globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package."; $core.addMethod( $core.method({ -selector: "isSend", -protocol: 'testing', +selector: "methods", +protocol: 'accessing', fn: function (){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $2,$1; +$1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){ +return $core.withContext(function($ctx2) { +$2=$recv(a)._selector(); +$ctx2.sendIdx["selector"]=1; +return $recv($2).__lt_eq($recv(b)._selector()); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isSend\x0a\x09^ true", +source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"] }), -$globals.IRSend); +$globals.ExportMethodProtocol); $core.addMethod( $core.method({ -selector: "selector", +selector: "name", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@selector"]; +$1=self["@name"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "selector\x0a\x09^ selector", +source: "name\x0a\x09^ name", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRSend); +$globals.ExportMethodProtocol); $core.addMethod( $core.method({ -selector: "selector:", +selector: "name:", protocol: 'accessing', fn: function (aString){ var self=this; -self["@selector"]=aString; +self["@name"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", +source: "name: aString\x0a\x09name := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRSend); - - +$globals.ExportMethodProtocol); -$core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "theClass", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(aVisitor)._visitIRSequence_(self); +$1=self["@theClass"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self", +args: [], +source: "theClass\x0a\x09^ theClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRSequence:"] +messageSends: [] }), -$globals.IRSequence); +$globals.ExportMethodProtocol); $core.addMethod( $core.method({ -selector: "isSequence", -protocol: 'testing', -fn: function (){ +selector: "theClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -return true; +self["@theClass"]=aClass; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSequence\x0a\x09^ true", +args: ["aClass"], +source: "theClass: aClass\x0a\x09theClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRSequence); - +$globals.ExportMethodProtocol); -$core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "name:theClass:", +protocol: 'instance creation', +fn: function (aString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRBlockSequence_(self); +var $2,$3,$1; +$2=self._new(); +$recv($2)._name_(aString); +$recv($2)._theClass_(aClass); +$3=$recv($2)._yourself(); +$1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self", +args: ["aString", "aClass"], +source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRBlockSequence:"] +messageSends: ["name:", "new", "theClass:", "yourself"] }), -$globals.IRBlockSequence); - +$globals.ExportMethodProtocol.klass); -$core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRValue.comment="I am the simplest possible instruction. I represent a value."; -//>>excludeEnd("ide"); +$core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport'); +$globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString"; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "import:", +protocol: 'fileIn', +fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var chunk,result,parser,lastEmpty; +function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)} +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRValue_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)}); -//>>excludeEnd("ctx"); +var $1,$2; +parser=$recv($ChunkParser())._on_(aStream); +lastEmpty=false; +self["@lastSection"]="n/a, not started"; +self["@lastChunk"]=nil; +$recv((function(){ +return $core.withContext(function($ctx2) { +$recv((function(){ +return $core.withContext(function($ctx3) { +chunk=$recv(parser)._nextChunk(); +chunk; +return $recv(chunk)._isNil(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}))._whileFalse_((function(){ +return $core.withContext(function($ctx3) { +$1=$recv(chunk)._isEmpty(); +if($core.assert($1)){ +lastEmpty=true; +return lastEmpty; +} else { +self["@lastSection"]=chunk; +self["@lastSection"]; +result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk); +result; +$2=lastEmpty; +if($core.assert($2)){ +lastEmpty=false; +lastEmpty; +return $recv(result)._scanFrom_(parser); +}; +}; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +self["@lastSection"]="n/a, finished"; +return self["@lastSection"]; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(e){ +return $core.withContext(function($ctx2) { +self["@lastChunk"]=$recv(parser)._last(); +self["@lastChunk"]; +return $recv(e)._resignal(); +}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRValue:"] +args: ["aStream"], +source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].", +referencedClasses: ["ChunkParser", "Compiler", "Error"], +messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"] }), -$globals.IRValue); +$globals.Importer); $core.addMethod( $core.method({ -selector: "needsBoxingAsReceiver", -protocol: 'testing', +selector: "lastChunk", +protocol: 'accessing', fn: function (){ var self=this; -return false; +var $1; +$1=self["@lastChunk"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "needsBoxingAsReceiver\x0a\x09^ false", +source: "lastChunk\x0a\x09^ lastChunk", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRValue); +$globals.Importer); $core.addMethod( $core.method({ -selector: "value", +selector: "lastSection", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@value"]; +$1=self["@lastSection"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "value\x0a\x09^ value", +source: "lastSection\x0a\x09^ lastSection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRValue); +$globals.Importer); -$core.addMethod( -$core.method({ -selector: "value:", -protocol: 'accessing', -fn: function (aString){ -var self=this; -self["@value"]=aString; -return self; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "value: aString\x0a\x09value := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRValue); +$core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport'); +$globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed."; -$core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRVariable.comment="I am a variable instruction."; -//>>excludeEnd("ide"); +$core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport'); +$globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "ajaxPutAt:data:onSuccess:onError:", +protocol: 'private', +fn: function (aURL,aString,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var xhr; +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRVariable_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)}); -//>>excludeEnd("ctx"); +var $1,$4,$3,$2; +xhr=$recv($Platform())._newXhr(); +$recv(xhr)._open_url_async_("PUT",aURL,true); +$recv(xhr)._onreadystatechange_((function(){ +return $core.withContext(function($ctx2) { +$1=$recv($recv(xhr)._readyState()).__eq((4)); +if($core.assert($1)){ +$4=$recv(xhr)._status(); +$ctx2.sendIdx["status"]=1; +$3=$recv($4).__gt_eq((200)); +$2=$recv($3)._and_((function(){ +return $core.withContext(function($ctx3) { +return $recv($recv(xhr)._status()).__lt((300)); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$recv(xhr)._send_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRVariable:"] +args: ["aURL", "aString", "aBlock", "anotherBlock"], +source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09| xhr |\x0a\x09xhr := Platform newXhr.\x0a\x09xhr open: 'PUT' url: aURL async: true.\x0a\x09xhr onreadystatechange: [\x0a\x09\x09xhr readyState = 4 ifTrue: [\x0a\x09\x09\x09(xhr status >= 200 and: [ xhr status < 300 ])\x0a\x09\x09\x09\x09ifTrue: aBlock\x0a\x09\x09\x09\x09ifFalse: anotherBlock ]].\x0a\x09xhr send: aString", +referencedClasses: ["Platform"], +messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"] }), -$globals.IRVariable); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "isVariable", -protocol: 'testing', -fn: function (){ +selector: "chunkContentsFor:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -return true; - +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($String())._streamContents_((function(str){ +return $core.withContext(function($ctx2) { +return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str); +}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isVariable\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aPackage"], +source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]", +referencedClasses: ["String"], +messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"] }), -$globals.IRVariable); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "needsBoxingAsReceiver", -protocol: 'testing', +selector: "chunkExporter", +protocol: 'factory', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($recv(self._variable())._isPseudoVar())._not(); +$1=$recv(self._chunkExporterClass())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not", +source: "chunkExporter\x0a\x09^ self chunkExporterClass new", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["not", "isPseudoVar", "variable"] +messageSends: ["new", "chunkExporterClass"] }), -$globals.IRVariable); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "variable", +selector: "chunkExporterClass", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@variable"]; -return $1; +function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)} +return $ChunkExporter(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "variable\x0a\x09^ variable", -referencedClasses: [], -//>>excludeEnd("ide"); +source: "chunkExporterClass\x0a\x09^ ChunkExporter", +referencedClasses: ["ChunkExporter"], messageSends: [] }), -$globals.IRVariable); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "variable:", -protocol: 'accessing', -fn: function (aScopeVariable){ +selector: "commit:", +protocol: 'committing', +fn: function (aPackage){ var self=this; -self["@variable"]=aScopeVariable; -return self; +function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +self._commit_onSuccess_onError_(aPackage,(function(){ +}),(function(error){ +return $core.withContext(function($ctx2) { +$1=$recv($PackageCommitError())._new(); +$2=$1; +$3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22"); +$ctx2.sendIdx[","]=1; +$recv($2)._messageText_($3); +$4=$recv($1)._signal(); +return $4; +}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScopeVariable"], -source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aPackage"], +source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]", +referencedClasses: ["PackageCommitError"], +messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"] }), -$globals.IRVariable); - - +$globals.PackageHandler); -$core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "commit:onSuccess:onError:", +protocol: 'committing', +fn: function (aPackage,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRVerbatim_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)}); -//>>excludeEnd("ctx"); +self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){ +return $core.withContext(function($ctx2) { +return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){ +return $core.withContext(function($ctx3) { +$recv(aPackage)._beClean(); +return $recv(aBlock)._value(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}),anotherBlock); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),anotherBlock); +return self; +}, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self", +args: ["aPackage", "aBlock", "anotherBlock"], +source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRVerbatim:"] +messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"] }), -$globals.IRVerbatim); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "source", -protocol: 'accessing', -fn: function (){ +selector: "commitJsFileFor:onSuccess:onError:", +protocol: 'committing', +fn: function (aPackage,aBlock,anotherBlock){ var self=this; -var $1; -$1=self["@source"]; -return $1; - +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); +$ctx1.sendIdx[","]=2; +$1=$recv($2).__comma(".js"); +$ctx1.sendIdx[","]=1; +self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock); +return self; +}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "source\x0a\x09^ source", +args: ["aPackage", "aBlock", "anotherBlock"], +source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"] }), -$globals.IRVerbatim); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "source:", +selector: "commitPathJsFor:", protocol: 'accessing', -fn: function (aString){ +fn: function (aPackage){ var self=this; -self["@source"]=aString; +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); return self; - +}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "source: aString\x0a\x09source := aString", +args: ["aPackage"], +source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.IRVerbatim); - - +$globals.PackageHandler); -$core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "visit:", -protocol: 'visiting', -fn: function (anIRInstruction){ +selector: "commitPathStFor:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(anIRInstruction)._accept_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self", +args: ["aPackage"], +source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["accept:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRAssignment:", -protocol: 'visiting', -fn: function (anIRAssignment){ +selector: "commitStFileFor:onSuccess:onError:", +protocol: 'committing', +fn: function (aPackage,aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRAssignment); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRAssignment"], -source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment", +var $2,$1; +$2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); +$ctx1.sendIdx[","]=2; +$1=$recv($2).__comma(".st"); +$ctx1.sendIdx[","]=1; +self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock); +return self; +}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); +}, +args: ["aPackage", "aBlock", "anotherBlock"], +source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRBlockReturn:", -protocol: 'visiting', -fn: function (anIRBlockReturn){ +selector: "contentsFor:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRReturn_(anIRBlockReturn); +$1=$recv($String())._streamContents_((function(str){ +return $core.withContext(function($ctx2) { +return $recv(self._exporter())._exportPackage_on_(aPackage,str); +}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); +})); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRBlockReturn"], -source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRReturn:"] +args: ["aPackage"], +source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]", +referencedClasses: ["String"], +messageSends: ["streamContents:", "exportPackage:on:", "exporter"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRBlockSequence:", -protocol: 'visiting', -fn: function (anIRBlockSequence){ +selector: "exporter", +protocol: 'factory', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRSequence_(anIRBlockSequence); +$1=$recv(self._exporterClass())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRBlockSequence"], -source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence", +args: [], +source: "exporter\x0a\x09^ self exporterClass new", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRSequence:"] +messageSends: ["new", "exporterClass"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRClosure:", -protocol: 'visiting', -fn: function (anIRClosure){ +selector: "exporterClass", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRClosure); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure"], -source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure", +args: [], +source: "exporterClass\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRDynamicArray:", -protocol: 'visiting', -fn: function (anIRDynamicArray){ +selector: "load:", +protocol: 'loading', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRDynamicArray); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRDynamicArray"], -source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray", +args: ["aPackage"], +source: "load: aPackage\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRVisitor); +$globals.PackageHandler); $core.addMethod( $core.method({ -selector: "visitIRDynamicDictionary:", -protocol: 'visiting', -fn: function (anIRDynamicDictionary){ +selector: "onCommitError:", +protocol: 'error handling', +fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRDynamicDictionary); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +var $1,$2,$3,$4; +$1=$recv($PackageCommitError())._new(); +$2=$1; +$3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22"); +$ctx1.sendIdx[","]=1; +$recv($2)._messageText_($3); +$4=$recv($1)._signal(); +return self; +}, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRDynamicDictionary"], -source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +args: ["anError"], +source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal", +referencedClasses: ["PackageCommitError"], +messageSends: ["messageText:", "new", ",", "responseText", "signal"] }), -$globals.IRVisitor); +$globals.PackageHandler); + + +$core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport'); +$globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; $core.addMethod( $core.method({ -selector: "visitIRInlinedClosure:", -protocol: 'visiting', -fn: function (anIRInlinedClosure){ +selector: "commitPathJsFor:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRClosure_(anIRInlinedClosure); +$1=self._toUrl_(self._namespaceFor_(aPackage)); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedClosure"], -source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure", +args: ["aPackage"], +source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRClosure:"] +messageSends: ["toUrl:", "namespaceFor:"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); $core.addMethod( $core.method({ -selector: "visitIRInlinedSequence:", -protocol: 'visiting', -fn: function (anIRInlinedSequence){ +selector: "commitPathStFor:", +protocol: 'accessing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var path,pathWithout; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRSequence_(anIRInlinedSequence); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +var $1,$3,$2; +$1=$recv(self._namespaceFor_(aPackage)).__comma("/_source"); +$ctx1.sendIdx[","]=1; +path=self._toUrl_($1); +pathWithout=self._commitPathJsFor_(aPackage); +$3=$recv(path).__eq($recv(pathWithout).__comma("/_source")); +if($core.assert($3)){ +$2=pathWithout; +} else { +$2=path; +}; +return $2; +}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedSequence"], -source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence", +args: ["aPackage"], +source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRSequence:"] +messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); $core.addMethod( $core.method({ -selector: "visitIRInstruction:", -protocol: 'visiting', -fn: function (anIRInstruction){ +selector: "exporterClass", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv(anIRInstruction)._instructions())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return anIRInstruction; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)} +return $AmdExporter(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "instructions", "visit:"] +args: [], +source: "exporterClass\x0a\x09^ AmdExporter", +referencedClasses: ["AmdExporter"], +messageSends: [] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); $core.addMethod( $core.method({ -selector: "visitIRMethod:", -protocol: 'visiting', -fn: function (anIRMethod){ +selector: "load:", +protocol: 'loading', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRMethod); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +var $1,$3,$2,$receiver; +$1=$recv($Smalltalk())._amdRequire(); +if(($receiver = $1) == null || $receiver.isNil){ +self._error_("AMD loader not present"); +} else { +var require; +require=$receiver; +$3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); +$ctx1.sendIdx[","]=1; +$2=$recv($Array())._with_($3); +$recv(require)._value_($2); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRMethod"], -source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +args: ["aPackage"], +source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]", +referencedClasses: ["Smalltalk", "Array"], +messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); $core.addMethod( $core.method({ -selector: "visitIRNonLocalReturn:", -protocol: 'visiting', -fn: function (anIRNonLocalReturn){ +selector: "namespaceFor:", +protocol: 'committing', +fn: function (aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRInstruction_(anIRNonLocalReturn); +$1=$recv($recv(aPackage)._transport())._namespace(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRNonLocalReturn"], -source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn", +args: ["aPackage"], +source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["namespace", "transport"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); $core.addMethod( $core.method({ -selector: "visitIRNonLocalReturnHandling:", -protocol: 'visiting', -fn: function (anIRNonLocalReturnHandling){ +selector: "toUrl:", +protocol: 'private', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRNonLocalReturnHandling); +var $2,$1,$receiver; +$2=$recv($Smalltalk())._amdRequire(); +if(($receiver = $2) == null || $receiver.isNil){ +$1=self._error_("AMD loader not present"); +} else { +var require; +require=$receiver; +$1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString); +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRNonLocalReturnHandling"], -source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +args: ["aString"], +source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]", +referencedClasses: ["Smalltalk"], +messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler); + $core.addMethod( $core.method({ -selector: "visitIRReturn:", -protocol: 'visiting', -fn: function (anIRReturn){ +selector: "defaultNamespace", +protocol: 'commit paths', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRInstruction_(anIRReturn); +$1=$recv($Smalltalk())._defaultAmdNamespace(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRReturn"], -source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +args: [], +source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace", +referencedClasses: ["Smalltalk"], +messageSends: ["defaultAmdNamespace"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler.klass); $core.addMethod( $core.method({ -selector: "visitIRSend:", -protocol: 'visiting', -fn: function (anIRSend){ +selector: "defaultNamespace:", +protocol: 'commit paths', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRSend); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +$recv($Smalltalk())._defaultAmdNamespace_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +args: ["aString"], +source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString", +referencedClasses: ["Smalltalk"], +messageSends: ["defaultAmdNamespace:"] }), -$globals.IRVisitor); +$globals.AmdPackageHandler.klass); + +$core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport'); +$globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated."; $core.addMethod( $core.method({ -selector: "visitIRSequence:", -protocol: 'visiting', -fn: function (anIRSequence){ +selector: "asJSON", +protocol: 'converting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRInstruction_(anIRSequence); +$1=$globals.HashedCollection._newFromPairs_(["type",self._type()]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSequence"], -source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence", +args: [], +source: "asJSON\x0a\x09^ #{ 'type' -> self type }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["type"] }), -$globals.IRVisitor); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "visitIRTempDeclaration:", -protocol: 'visiting', -fn: function (anIRTempDeclaration){ +selector: "commit", +protocol: 'committing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRTempDeclaration); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +$recv(self._commitHandler())._commit_(self._package()); +return self; +}, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRTempDeclaration"], -source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration", +args: [], +source: "commit\x0a\x09self commitHandler commit: self package", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["commit:", "commitHandler", "package"] }), -$globals.IRVisitor); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "visitIRValue:", -protocol: 'visiting', -fn: function (anIRValue){ +selector: "commitHandler", +protocol: 'factory', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._visitIRInstruction_(anIRValue); +$1=$recv(self._commitHandlerClass())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRValue"], -source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue", +args: [], +source: "commitHandler\x0a\x09^ self commitHandlerClass new", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["new", "commitHandlerClass"] }), -$globals.IRVisitor); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "visitIRVariable:", -protocol: 'visiting', -fn: function (anIRVariable){ +selector: "commitHandlerClass", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRVariable); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRVariable"], -source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable", +args: [], +source: "commitHandlerClass\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRVisitor); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "visitIRVerbatim:", -protocol: 'visiting', -fn: function (anIRVerbatim){ +selector: "commitOnSuccess:onError:", +protocol: 'committing', +fn: function (aBlock,anotherBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._visitIRInstruction_(anIRVerbatim); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)}); -//>>excludeEnd("ctx"); +$recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock); +return self; +}, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRVerbatim"], -source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim", +args: ["aBlock", "anotherBlock"], +source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInstruction:"] +messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"] }), -$globals.IRVisitor); +$globals.PackageTransport); +$core.addMethod( +$core.method({ +selector: "definition", +protocol: 'accessing', +fn: function (){ +var self=this; +return ""; +}, +args: [], +source: "definition\x0a\x09^ ''", +referencedClasses: [], +messageSends: [] +}), +$globals.PackageTransport); -$core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "contents", -protocol: 'accessing', +selector: "load", +protocol: 'loading', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._stream())._contents(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +$recv(self._commitHandler())._load_(self._package()); +return self; +}, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "contents\x0a\x09^ self stream contents", +source: "load\x0a\x09self commitHandler load: self package", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["contents", "stream"] +messageSends: ["load:", "commitHandler", "package"] }), -$globals.IRJSTranslator); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "currentClass", +selector: "package", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@currentClass"]; +$1=self["@package"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "currentClass\x0a\x09^ currentClass", +source: "package\x0a\x09^ package", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRJSTranslator); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "currentClass:", +selector: "package:", protocol: 'accessing', -fn: function (aClass){ +fn: function (aPackage){ var self=this; -self["@currentClass"]=aClass; +self["@package"]=aPackage; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "currentClass: aClass\x0a\x09currentClass := aClass", +args: ["aPackage"], +source: "package: aPackage\x0a\x09package := aPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRJSTranslator); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "initialize", +selector: "setupFromJson:", protocol: 'initialization', -fn: function (){ +fn: function (anObject){ var self=this; -function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@stream"]=$recv($JSStream())._new(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.", -referencedClasses: ["JSStream"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "new"] +args: ["anObject"], +source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22", +referencedClasses: [], +messageSends: [] }), -$globals.IRJSTranslator); +$globals.PackageTransport); $core.addMethod( $core.method({ -selector: "stream", +selector: "type", protocol: 'accessing', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@stream"]; +$1=$recv(self._class())._type(); return $1; - +}, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "stream\x0a\x09^ stream", +source: "type\x0a\x09^ self class type", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["type", "class"] }), -$globals.IRJSTranslator); - -$core.addMethod( -$core.method({ -selector: "stream:", -protocol: 'accessing', -fn: function (aStream){ -var self=this; -self["@stream"]=aStream; -return self; +$globals.PackageTransport); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStream"], -source: "stream: aStream\x0a\x09stream := aStream", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.IRJSTranslator); +$globals.PackageTransport.klass.iVarNames = ['registry']; $core.addMethod( $core.method({ -selector: "visitIRAssignment:", -protocol: 'visiting', -fn: function (anIRAssignment){ +selector: "classRegisteredFor:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv(anIRAssignment)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._first(); -self._visit_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -$recv(self._stream())._nextPutAssignment(); -self._visit_($recv($recv(anIRAssignment)._instructions())._last()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self["@registry"])._at_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRAssignment"], -source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.", +args: ["aString"], +source: "classRegisteredFor: aString\x0a\x09^ registry at: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"] +messageSends: ["at:"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRClosure:", -protocol: 'visiting', -fn: function (anIRClosure){ +selector: "defaultType", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutClosureWith_arguments_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._name())._asVariableName(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))); -return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$recv(anIRClosure)._arguments()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($AmdPackageTransport())._type(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure"], -source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"] +args: [], +source: "defaultType\x0a\x09^ AmdPackageTransport type", +referencedClasses: ["AmdPackageTransport"], +messageSends: ["type"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRDynamicArray:", -protocol: 'visiting', -fn: function (anIRDynamicArray){ +selector: "for:", +protocol: 'instance creation', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(self["@stream"])._nextPutAll_("]"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +$1=$recv(self._classRegisteredFor_(aString))._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRDynamicArray"], -source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'", +args: ["aString"], +source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"] +messageSends: ["new", "classRegisteredFor:"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRDynamicDictionary:", -protocol: 'visiting', -fn: function (anIRDynamicDictionary){ +selector: "fromJson:", +protocol: 'instance creation', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_(["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -return $recv($2)._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(self._stream())._nextPutAll_("])"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $1,$3,$4,$2,$receiver; +if(($receiver = anObject) == null || $receiver.isNil){ +$1=self._for_(self._defaultType()); +$ctx1.sendIdx["for:"]=1; +return $1; +} else { +anObject; +}; +$3=self._for_($recv(anObject)._type()); +$recv($3)._setupFromJson_(anObject); +$4=$recv($3)._yourself(); +$2=$4; +return $2; +}, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRDynamicDictionary"], -source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: '$globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'", +args: ["anObject"], +source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"] +messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRMethod:", -protocol: 'visiting', -fn: function (anIRMethod){ +selector: "initialize", +protocol: 'initialization', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -return $recv($2)._nextPutFunctionWith_arguments_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$3=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["stream"]=3; -//>>excludeEnd("ctx"); -$4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._name())._asVariableName(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["collect:"]=1; -//>>excludeEnd("ctx"); -$recv($3)._nextPutVars_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nextPutVars:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(anIRMethod)._classReferences())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -$5=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["stream"]=4; -//>>excludeEnd("ctx"); -return $recv($5)._nextPutClassRefFunction_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)}); -//>>excludeEnd("ctx"); -})); -$6=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["stream"]=5; -//>>excludeEnd("ctx"); -return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -$8=$recv(anIRMethod)._internalVariables(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["internalVariables"]=1; -//>>excludeEnd("ctx"); -$7=$recv($8)._notEmpty(); -if($core.assert($7)){ -$9=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.sendIdx["stream"]=6; -//>>excludeEnd("ctx"); -$recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx5) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._variable())._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)}); -//>>excludeEnd("ctx"); -}))); -}; -$10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn(); -if($core.assert($10)){ -return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx5) { -//>>excludeEnd("ctx"); -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx5.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx5.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx5.sendIdx["visitIRMethod:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)}); -//>>excludeEnd("ctx"); -})); +var $1; +( +$ctx1.supercall = true, +$globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +$1=self.__eq_eq($PackageTransport()); +if($core.assert($1)){ +self["@registry"]=$globals.HashedCollection._newFromPairs_([]); +self["@registry"]; } else { -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx4.supercall = false; -//>>excludeEnd("ctx");; +self._register(); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}),$recv(anIRMethod)._arguments()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRMethod"], -source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"] +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]", +referencedClasses: ["PackageTransport"], +messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRNonLocalReturn:", -protocol: 'visiting', -fn: function (anIRNonLocalReturn){ +selector: "register", +protocol: 'registration', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._stream())._nextPutNonLocalReturnWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +$recv($PackageTransport())._register_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRNonLocalReturn"], -source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"] +args: [], +source: "register\x0a\x09PackageTransport register: self", +referencedClasses: ["PackageTransport"], +messageSends: ["register:"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRReturn:", -protocol: 'visiting', -fn: function (anIRReturn){ +selector: "register:", +protocol: 'registration', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._stream())._nextPutReturnWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1,$receiver; +$1=$recv(aClass)._type(); +$ctx1.sendIdx["type"]=1; +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +$recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRReturn"], -source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]", +args: ["aClass"], +source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"] +messageSends: ["ifNotNil:", "type", "at:put:"] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); $core.addMethod( $core.method({ -selector: "visitIRSend:", -protocol: 'visiting', -fn: function (anIRSend){ +selector: "type", +protocol: 'accessing', +fn: function (){ var self=this; -var sends; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size(); -$1=$recv(anIRSend)._classSend(); -if(($receiver = $1) == null || $receiver.isNil){ -self._visitSend_(anIRSend); -} else { -self._visitSuperSend_(anIRSend); -}; -$2=$recv($recv(sends).__gt((1)))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(anIRSend)._index()).__lt(sends); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($2)){ -$recv(self._stream())._nextPutSendIndexFor_(anIRSend); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +return nil; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]", +args: [], +source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"] +messageSends: [] }), -$globals.IRJSTranslator); +$globals.PackageTransport.klass); + +$core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport'); +$globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`."; $core.addMethod( $core.method({ -selector: "visitIRSequence:", -protocol: 'visiting', -fn: function (anIRSequence){ +selector: "asJSON", +protocol: 'converting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutSequenceWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(anIRSequence)._instructions())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutStatementWith_(self._visit_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=( +$ctx1.supercall = true, +$globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), [])); +$ctx1.supercall = false; +$recv($2)._at_put_("amdNamespace",self._namespace()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSequence"], -source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]", +args: [], +source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"] +messageSends: ["at:put:", "asJSON", "namespace", "yourself"] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitIRTempDeclaration:", -protocol: 'visiting', -fn: function (anIRTempDeclaration){ +selector: "commitHandlerClass", +protocol: 'accessing', +fn: function (){ var self=this; -return self; +function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)} +return $AmdPackageHandler(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRTempDeclaration"], -source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22", -referencedClasses: [], -//>>excludeEnd("ide"); +args: [], +source: "commitHandlerClass\x0a\x09^ AmdPackageHandler", +referencedClasses: ["AmdPackageHandler"], messageSends: [] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitIRValue:", -protocol: 'visiting', -fn: function (anIRValue){ +selector: "defaultNamespace", +protocol: 'defaults', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($Smalltalk())._defaultAmdNamespace(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRValue"], -source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "stream", "asJavascript", "value"] +args: [], +source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace", +referencedClasses: ["Smalltalk"], +messageSends: ["defaultAmdNamespace"] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitIRVariable:", -protocol: 'visiting', -fn: function (anIRVariable){ +selector: "definition", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$4; -$3=$recv(anIRVariable)._variable(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["variable"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._name(); -$1=$recv($2).__eq("thisContext"); -if($core.assert($1)){ -$4=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($4)._nextPutAll_("$core.getThisContext()"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -} else { -$recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias()); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +var $3,$2,$1; +$1=$recv($String())._streamContents_((function(stream){ +return $core.withContext(function($ctx2) { +$recv(stream)._nextPutAll_($recv(self._class())._name()); +$ctx2.sendIdx["nextPutAll:"]=1; +$recv(stream)._nextPutAll_(" namespace: "); +$ctx2.sendIdx["nextPutAll:"]=2; +$3=$recv("'".__comma(self._namespace())).__comma("'"); +$ctx2.sendIdx[","]=1; +$2=$recv(stream)._nextPutAll_($3); +return $2; +}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRVariable"], -source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"] +args: [], +source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]", +referencedClasses: ["String"], +messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitIRVerbatim:", -protocol: 'visiting', -fn: function (anIRVerbatim){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +selector: "namespace", +protocol: 'accessing', +fn: function (){ +var self=this; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutStatementWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $2,$1,$receiver; +$2=self["@namespace"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=self._defaultNamespace(); +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)}); +}, +args: [], +source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]", +referencedClasses: [], +messageSends: ["ifNil:", "defaultNamespace"] +}), +$globals.AmdPackageTransport); + +$core.addMethod( +$core.method({ +selector: "namespace:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@namespace"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRVerbatim"], -source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]", +args: ["aString"], +source: "namespace: aString\x0a\x09namespace := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"] +messageSends: [] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitReceiver:", -protocol: 'visiting', -fn: function (anIRInstruction){ +selector: "printOn:", +protocol: 'printing', +fn: function (aStream){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -$1=$recv(anIRInstruction)._needsBoxingAsReceiver(); -if(!$core.assert($1)){ -$2=self._visit_(anIRInstruction); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $2; -}; -$3=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($3)._nextPutAll_("$recv("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +( +$ctx1.supercall = true, +$globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); +$ctx1.supercall = false; +$recv(aStream)._nextPutAll_(" (AMD Namespace: "); $ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -self._visit_(anIRInstruction); -$recv(self._stream())._nextPutAll_(")"); +$recv(aStream)._nextPutAll_(self._namespace()); +$ctx1.sendIdx["nextPutAll:"]=2; +$1=$recv(aStream)._nextPutAll_(")"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'", +args: ["aStream"], +source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"] +messageSends: ["printOn:", "nextPutAll:", "namespace"] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitSend:", -protocol: 'visiting', -fn: function (anIRSend){ +selector: "setPath:", +protocol: 'actions', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$4,$5; -$2=$recv(anIRSend)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._first(); -self._visitReceiver_($1); -$3=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($3)._nextPutAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$5=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -return $recv($5)._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(self._stream())._nextPutAll_(")"); +$recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'", +args: ["aString"], +source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"] +messageSends: ["value:", "basicAt:", "namespace"] }), -$globals.IRJSTranslator); +$globals.AmdPackageTransport); $core.addMethod( $core.method({ -selector: "visitSuperSend:", -protocol: 'visiting', -fn: function (anIRSend){ +selector: "setupFromJson:", +protocol: 'initialization', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$2=$1; -$5=$recv(anIRSend)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__comma(".supercall = true, "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(".superclass.fn.prototype."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$6=$1; -$7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$recv($6)._nextPutAll_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$8=$recv($1)._nextPutAll_("$recv("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$10=$recv(anIRSend)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$9=$recv($10)._first(); -self._visit_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -$11=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$recv($11)._nextPutAll_("), ["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -$recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$12=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=3; -//>>excludeEnd("ctx"); -return $recv($12)._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$13=self._stream(); -$recv($13)._nextPutAll_("]));"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=11; -//>>excludeEnd("ctx"); -$recv($13)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=5; -//>>excludeEnd("ctx"); -$recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=12; -//>>excludeEnd("ctx"); -$recv($13)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=6; -//>>excludeEnd("ctx"); -$recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=13; -//>>excludeEnd("ctx"); -$recv($13)._lf(); -$14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +self._namespace_($recv(anObject)._at_("amdNamespace")); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +args: ["anObject"], +source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"] +messageSends: ["namespace:", "at:"] }), -$globals.IRJSTranslator); - +$globals.AmdPackageTransport); -$core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR'); $core.addMethod( $core.method({ -selector: "contents", -protocol: 'accessing', -fn: function (){ +selector: "namespace:", +protocol: 'instance creation', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self["@stream"])._contents(); +var $2,$3,$1; +$2=self._new(); +$recv($2)._namespace_(aString); +$3=$recv($2)._yourself(); +$1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "contents\x0a\x09^ stream contents", +args: ["aString"], +source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["contents"] +messageSends: ["namespace:", "new", "yourself"] }), -$globals.JSStream); +$globals.AmdPackageTransport.klass); $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', +selector: "type", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@stream"]=""._writeStream(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)}); -//>>excludeEnd("ctx"); +return "amd"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.", +source: "type\x0a\x09^ 'amd'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initialize", "writeStream"] +messageSends: [] }), -$globals.JSStream); +$globals.AmdPackageTransport.klass); $core.addMethod( $core.method({ -selector: "lf", -protocol: 'streaming', +selector: "commentStamp", +protocol: '*Platform-ImportExport', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($ClassCommentReader())._new(); +$recv($2)._class_(self); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "lf\x0a\x09stream lf", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lf"] +source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself", +referencedClasses: ["ClassCommentReader"], +messageSends: ["class:", "new", "yourself"] }), -$globals.JSStream); +$globals.Behavior); $core.addMethod( $core.method({ -selector: "nextPut:", -protocol: 'streaming', -fn: function (aString){ +selector: "commentStamp:prior:", +protocol: '*Platform-ImportExport', +fn: function (aStamp,prior){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._nextPut_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._commentStamp(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "nextPut: aString\x0a\x09stream nextPut: aString", +args: ["aStamp", "prior"], +source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPut:"] +messageSends: ["commentStamp"] }), -$globals.JSStream); +$globals.Behavior); $core.addMethod( $core.method({ -selector: "nextPutAll:", -protocol: 'streaming', +selector: "methodsFor:", +protocol: '*Platform-ImportExport', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._nextPutAll_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($ClassProtocolReader())._new(); +$recv($2)._class_category_(self,aString); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString", +source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself", +referencedClasses: ["ClassProtocolReader"], +messageSends: ["class:category:", "new", "yourself"] +}), +$globals.Behavior); + +$core.addMethod( +$core.method({ +selector: "methodsFor:stamp:", +protocol: '*Platform-ImportExport', +fn: function (aString,aStamp){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._methodsFor_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)}); +}, +args: ["aString", "aStamp"], +source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:"] +messageSends: ["methodsFor:"] }), -$globals.JSStream); +$globals.Behavior); $core.addMethod( $core.method({ -selector: "nextPutAssignment", -protocol: 'streaming', +selector: "commit", +protocol: '*Platform-ImportExport', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._nextPutAll_("="); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._transport())._commit(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "nextPutAssignment\x0a\x09stream nextPutAll: '='", +source: "commit\x0a\x09^ self transport commit", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:"] +messageSends: ["commit", "transport"] }), -$globals.JSStream); +$globals.Package); $core.addMethod( $core.method({ -selector: "nextPutBlockContextFor:during:", -protocol: 'streaming', -fn: function (anIRClosure,aBlock){ +selector: "load", +protocol: '*Platform-ImportExport', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24; -$1=$recv(anIRClosure)._requiresSmalltalkContext(); -if(!$core.assert($1)){ -$2=$recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -return $2; -}; -self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$6=$recv(anIRClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=1; -//>>excludeEnd("ctx"); -$4="return $core.withContext(function(".__comma($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$3=$recv($4).__comma(") {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -self._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$7=self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$11=$recv(anIRClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$10=$recv($11)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=2; -//>>excludeEnd("ctx"); -$9="}, function(".__comma($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$8=$recv($9).__comma(") {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -self._nextPutAll_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$15=$recv(anIRClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=3; -//>>excludeEnd("ctx"); -$14=$recv($15)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=3; -//>>excludeEnd("ctx"); -$13=$recv($14).__comma(".fillBlock({"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$12=self._nextPutAll_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$16=$recv(each)._asVariableName(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asVariableName"]=1; -//>>excludeEnd("ctx"); -self._nextPutAll_($16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -self._nextPutAll_(":"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$17=self._nextPutAll_($recv(each)._asVariableName()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -return $17; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -self._nextPutAll_("},"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=11; -//>>excludeEnd("ctx"); -$23=$recv(anIRClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=4; -//>>excludeEnd("ctx"); -$22=$recv($23)._outerScope(); -$21=$recv($22)._alias(); -$20=$recv($21).__comma(","); -$19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=7; -//>>excludeEnd("ctx"); -$18=$recv($19).__comma(")});"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); -self._nextPutAll_($18); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=12; -//>>excludeEnd("ctx"); -self._lf(); -$24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._transport())._load(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure", "aBlock"], -source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +args: [], +source: "load\x0a\x09^ self transport load", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"] +messageSends: ["load", "transport"] }), -$globals.JSStream); +$globals.Package); $core.addMethod( $core.method({ -selector: "nextPutClassRefFunction:", -protocol: 'streaming', +selector: "loadFromNamespace:", +protocol: '*Platform-ImportExport', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self["@stream"]; -$recv($1)._nextPutAll_("function $"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("(){return $globals."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("||(typeof "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("==\x22undefined\x22?nil:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_(")}"); -$2=$recv($1)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=self._transport(); +$recv($2)._namespace_(aString); +$3=$recv($2)._load(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return $globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf", +source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf"] +messageSends: ["namespace:", "transport", "load"] }), -$globals.JSStream); +$globals.Package); $core.addMethod( $core.method({ -selector: "nextPutClosureWith:arguments:", -protocol: 'streaming', -fn: function (aBlock,anArray){ +selector: "load:", +protocol: '*Platform-ImportExport', +fn: function (aPackageName){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$recv(self["@stream"])._nextPutAll_("(function("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(anArray)._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPut_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$1=self["@stream"]; -$recv($1)._nextPutAll_("){"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$2=$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -$3=self["@stream"]; -$recv($3)._lf(); -$4=$recv($3)._nextPutAll_("})"); +$recv(self._named_(aPackageName))._load(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anArray"], -source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'", +args: ["aPackageName"], +source: "load: aPackageName\x0a\x09(self named: aPackageName) load", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"] +messageSends: ["load", "named:"] }), -$globals.JSStream); +$globals.Package.klass); $core.addMethod( $core.method({ -selector: "nextPutContextFor:during:", -protocol: 'streaming', -fn: function (aMethod,aBlock){ +selector: "load:fromNamespace:", +protocol: '*Platform-ImportExport', +fn: function (aPackageName,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19; -$1=$recv(aMethod)._requiresSmalltalkContext(); -if(!$core.assert($1)){ -$2=$recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -return $2; -}; -self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$6=$recv(aMethod)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=1; -//>>excludeEnd("ctx"); -$4="return $core.withContext(function(".__comma($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$3=$recv($4).__comma(") {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -self._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$7=self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$12=$recv(aMethod)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$11=$recv($12)._alias(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["alias"]=2; -//>>excludeEnd("ctx"); -$10="}, function(".__comma($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$9=$recv($10).__comma(") {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -self._nextPutAll_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$16=$recv($recv(aMethod)._selector())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=1; -//>>excludeEnd("ctx"); -$15=".fill(self,".__comma($16); -$14=$recv($15).__comma(",{"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); -$13=self._nextPutAll_($14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv($recv(aMethod)._locals())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$17=$recv(each)._asVariableName(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asVariableName"]=1; -//>>excludeEnd("ctx"); -self._nextPutAll_($17); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -self._nextPutAll_(":"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$18=self._nextPutAll_($recv(each)._asVariableName()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -return $18; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -self._nextPutAll_("},"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=11; -//>>excludeEnd("ctx"); -self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=12; -//>>excludeEnd("ctx"); -self._nextPutAll_(")});"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=13; -//>>excludeEnd("ctx"); -self._lf(); -$19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +$recv(self._named_(aPackageName))._loadFromNamespace_(aString); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethod", "aBlock"], -source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +args: ["aPackageName", "aString"], +source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"] +messageSends: ["loadFromNamespace:", "named:"] }), -$globals.JSStream); +$globals.Package.klass); + +}); + +define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-Exceptions'); +$core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"}; + +$core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions'); +$globals.CompilerError.comment="I am the common superclass of all compiling errors."; + +$core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions'); +$globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`"; + + +$core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions'); +$globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling"; + + +$core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions'); +$globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`."; + + +$core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); +$globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned."; $core.addMethod( $core.method({ -selector: "nextPutFunctionWith:arguments:", -protocol: 'streaming', -fn: function (aBlock,anArray){ +selector: "messageText", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6; -$recv(self["@stream"])._nextPutAll_("fn: function("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(anArray)._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPut_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$1=self["@stream"]; -$recv($1)._nextPutAll_("){"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$2=$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$3=self["@stream"]; -$recv($3)._nextPutAll_("var self=this;"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$4=$recv($3)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -$5=self["@stream"]; -$recv($5)._lf(); -$6=$recv($5)._nextPutAll_("}"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=" Invalid assignment to variable: ".__comma(self._variableName()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anArray"], -source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'", +args: [], +source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"] +messageSends: [",", "variableName"] }), -$globals.JSStream); +$globals.InvalidAssignmentError); $core.addMethod( $core.method({ -selector: "nextPutIf:with:", -protocol: 'streaming', -fn: function (aBlock,anotherBlock){ +selector: "variableName", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$recv(self["@stream"])._nextPutAll_("if("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$1=self["@stream"]; -$recv($1)._nextPutAll_("){"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$2=$recv($1)._lf(); -$recv(anotherBlock)._value(); -$recv(self["@stream"])._nextPutAll_("}"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@variableName"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anotherBlock"], -source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'", +args: [], +source: "variableName\x0a\x09^ variableName", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "value", "lf"] +messageSends: [] }), -$globals.JSStream); +$globals.InvalidAssignmentError); $core.addMethod( $core.method({ -selector: "nextPutIfElse:with:with:", -protocol: 'streaming', -fn: function (aBlock,ifBlock,elseBlock){ +selector: "variableName:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$recv(self["@stream"])._nextPutAll_("if("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$1=self["@stream"]; -$recv($1)._nextPutAll_("){"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$2=$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(ifBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=2; -//>>excludeEnd("ctx"); -$3=self["@stream"]; -$recv($3)._nextPutAll_("} else {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$4=$recv($3)._lf(); -$recv(elseBlock)._value(); -$recv(self["@stream"])._nextPutAll_("}"); +self["@variableName"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "ifBlock", "elseBlock"], -source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'", +args: ["aString"], +source: "variableName: aString\x0a\x09variableName := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "value", "lf"] +messageSends: [] }), -$globals.JSStream); +$globals.InvalidAssignmentError); + + +$core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); +$globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope."; $core.addMethod( $core.method({ -selector: "nextPutMethodDeclaration:with:", -protocol: 'streaming', -fn: function (aMethod,aBlock){ +selector: "messageText", +protocol: 'accessing', +fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26; -$1=self["@stream"]; -$recv($1)._nextPutAll_("$core.method({"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$2=$1; -$5=$recv($recv(aMethod)._selector())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=1; -//>>excludeEnd("ctx"); -$4="selector: ".__comma($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$3=$recv($4).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined"); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$6=$1; -$9=$recv($recv(aMethod)._source())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=2; -//>>excludeEnd("ctx"); -$8="source: ".__comma($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$7=$recv($8).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -$recv($6)._nextPutAll_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$10=$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$11=self["@stream"]; -$12=$11; -$15=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$14=",".__comma($15); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); -$13=$recv($14).__comma("messageSends: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$recv($12)._nextPutAll_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$16=$11; -$19=$recv($recv(aMethod)._messageSends())._asArray(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asArray"]=1; -//>>excludeEnd("ctx"); -$18=$recv($19)._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=3; -//>>excludeEnd("ctx"); -$17=$recv($18).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=7; -//>>excludeEnd("ctx"); -$recv($16)._nextPutAll_($17); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$recv($11)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=5; -//>>excludeEnd("ctx"); -$20=$11; -$23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._asArray())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=4; -//>>excludeEnd("ctx"); -$22="args: ".__comma($23); -$21=$recv($22).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=8; -//>>excludeEnd("ctx"); -$recv($20)._nextPutAll_($21); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv($11)._lf(); -$24=$recv($11)._nextPutAll_("referencedClasses: ["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$25=self["@stream"]; -$recv($25)._nextPutAll_("]"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -$26=$recv($25)._nextPutAll_("})"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethod", "aBlock"], -source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"] +args: [], +source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'", +referencedClasses: [], +messageSends: [",", "variableName"] }), -$globals.JSStream); +$globals.ShadowingVariableError); $core.addMethod( $core.method({ -selector: "nextPutNonLocalReturnHandlingWith:", -protocol: 'streaming', -fn: function (aBlock){ +selector: "variableName", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$1=self["@stream"]; -$recv($1)._nextPutAll_("var $early={};"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_("try {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$2=$recv($1)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -$3=self["@stream"]; -$recv($3)._nextPutAll_("}"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv($3)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}"); -$4=$recv($3)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@variableName"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf", +args: [], +source: "variableName\x0a\x09^ variableName", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf", "value"] +messageSends: [] }), -$globals.JSStream); +$globals.ShadowingVariableError); $core.addMethod( $core.method({ -selector: "nextPutNonLocalReturnWith:", -protocol: 'streaming', -fn: function (aBlock){ +selector: "variableName:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._nextPutAll_("throw $early=["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -$recv(self["@stream"])._nextPutAll_("]"); +self["@variableName"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'", +args: ["aString"], +source: "variableName: aString\x0a\x09variableName := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "value"] +messageSends: [] }), -$globals.JSStream); +$globals.ShadowingVariableError); + + +$core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions'); +$globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects."; $core.addMethod( $core.method({ -selector: "nextPutReturn", -protocol: 'streaming', +selector: "messageText", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@stream"])._nextPutAll_("return "); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined"); +$ctx1.sendIdx[","]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '", +source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:"] +messageSends: [",", "variableName"] }), -$globals.JSStream); +$globals.UnknownVariableError); $core.addMethod( $core.method({ -selector: "nextPutReturnWith:", -protocol: 'streaming', -fn: function (aBlock){ +selector: "variableName", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._nextPutReturn(); -$recv(aBlock)._value(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@variableName"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value", +args: [], +source: "variableName\x0a\x09^ variableName", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutReturn", "value"] +messageSends: [] }), -$globals.JSStream); +$globals.UnknownVariableError); $core.addMethod( $core.method({ -selector: "nextPutSendIndexFor:", -protocol: 'streaming', -fn: function (anIRSend){ +selector: "variableName:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._nextPutAll_(";"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -self._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -self._nextPutAll_($recv($recv(anIRSend)._scope())._alias()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -self._nextPutAll_(".sendIdx["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -self._nextPutAll_("]="); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -self._nextPutAll_($recv($recv(anIRSend)._index())._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -self._nextPutAll_(";"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -self._lf(); -$1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)"); +self["@variableName"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'", +args: ["aString"], +source: "variableName: aString\x0a\x09variableName := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"] +messageSends: [] }), -$globals.JSStream); +$globals.UnknownVariableError); -$core.addMethod( -$core.method({ -selector: "nextPutSequenceWith:", -protocol: 'streaming', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value"] -}), -$globals.JSStream); -$core.addMethod( -$core.method({ -selector: "nextPutStatementWith:", -protocol: 'streaming', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$recv(aBlock)._value(); -$1=self["@stream"]; -$recv($1)._nextPutAll_(";"); -$2=$recv($1)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value", "nextPutAll:", "lf"] -}), -$globals.JSStream); +$core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions'); +$globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted."; $core.addMethod( $core.method({ -selector: "nextPutVars:", -protocol: 'streaming', -fn: function (aCollection){ +selector: "basicSignal:", +protocol: 'error handling', +fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -$recv(aCollection)._ifEmpty_((function(){ -throw $early=[self]; - -})); -$recv(self["@stream"])._nextPutAll_("var "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aCollection)._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@stream"])._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$1=self["@stream"]; -$recv($1)._nextPutAll_(";"); -$2=$recv($1)._lf(); +throw anError; return self; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf", +args: ["anError"], +source: "basicSignal: anError\x0a ", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"] +messageSends: [] }), -$globals.JSStream); - +$globals.RethrowErrorHandler); $core.addMethod( $core.method({ -selector: "appendToInstruction:", -protocol: '*Compiler-IR', -fn: function (anIRInstruction){ +selector: "handleError:", +protocol: 'error handling', +fn: function (anError){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(anIRInstruction)._appendBlock_(self); +self._basicSignal_(anError); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self", +args: ["anError"], +source: "handleError: anError\x0a self basicSignal: anError", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["appendBlock:"] +messageSends: ["basicSignal:"] }), -$globals.BlockClosure); +$globals.RethrowErrorHandler); + }); -define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){ +define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){ var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Inlining'); -$core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addPackage('Compiler-Core'); +$core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"}; -$core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction."; -//>>excludeEnd("ide"); +$core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core'); +$globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API."; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "classNameFor:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRInlinedAssignment_(self); +var $2,$3,$4,$1; +$2=$recv(aClass)._isMetaclass(); +if($core.assert($2)){ +$3=$recv($recv(aClass)._instanceClass())._name(); +$ctx1.sendIdx["name"]=1; +$1=$recv($3).__comma(".klass"); +} else { +$4=$recv(aClass)._isNil(); +if($core.assert($4)){ +$1="nil"; +} else { +$1=$recv(aClass)._name(); +}; +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedAssignment:"] -}), -$globals.IRInlinedAssignment); - -$core.addMethod( -$core.method({ -selector: "isInlined", -protocol: 'testing', -fn: function (){ -var self=this; -return true; - +}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isInlined\x0a\x09^ true", +args: ["aClass"], +source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"] }), -$globals.IRInlinedAssignment); - - +$globals.AbstractCodeGenerator); -$core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedClosure.comment="I represent an inlined closure instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "compileNode:", +protocol: 'compiling', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedClosure_(self); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self", +args: ["aNode"], +source: "compileNode: aNode\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedClosure:"] +messageSends: ["subclassResponsibility"] }), -$globals.IRInlinedClosure); +$globals.AbstractCodeGenerator); $core.addMethod( $core.method({ -selector: "isInlined", -protocol: 'testing', +selector: "currentClass", +protocol: 'accessing', fn: function (){ var self=this; -return true; +var $1; +$1=self["@currentClass"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isInlined\x0a\x09^ true", +source: "currentClass\x0a\x09^ currentClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRInlinedClosure); - - +$globals.AbstractCodeGenerator); -$core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedReturn.comment="I represent an inlined local return instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "currentClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(aVisitor)._visitIRInlinedReturn_(self); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)}); -//>>excludeEnd("ctx"); +self["@currentClass"]=aClass; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self", +args: ["aClass"], +source: "currentClass: aClass\x0a\x09currentClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedReturn:"] +messageSends: [] }), -$globals.IRInlinedReturn); +$globals.AbstractCodeGenerator); $core.addMethod( $core.method({ -selector: "isInlined", -protocol: 'testing', +selector: "currentPackage", +protocol: 'accessing', fn: function (){ var self=this; -return true; +var $1; +$1=self["@currentPackage"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isInlined\x0a\x09^ true", +source: "currentPackage\x0a\x09^ currentPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.IRInlinedReturn); - - +$globals.AbstractCodeGenerator); -$core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "currentPackage:", +protocol: 'accessing', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitInlinedSend_(self); +self["@currentPackage"]=anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self", +args: ["anObject"], +source: "currentPackage: anObject\x0a\x09currentPackage := anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitInlinedSend:"] +messageSends: [] }), -$globals.IRInlinedSend); +$globals.AbstractCodeGenerator); $core.addMethod( $core.method({ -selector: "internalVariables", +selector: "pseudoVariables", protocol: 'accessing', fn: function (){ var self=this; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { var $1; -$1=[]; +$1=$recv($Smalltalk())._pseudoVariableNames(); return $1; - +}, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames", +referencedClasses: ["Smalltalk"], +messageSends: ["pseudoVariableNames"] }), -$globals.IRInlinedSend); +$globals.AbstractCodeGenerator); $core.addMethod( $core.method({ -selector: "isInlined", -protocol: 'testing', +selector: "source", +protocol: 'accessing', fn: function (){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@source"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=""; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isInlined\x0a\x09^ true", +source: "source\x0a\x09^ source ifNil: [ '' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNil:"] }), -$globals.IRInlinedSend); - - +$globals.AbstractCodeGenerator); -$core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "source:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedIfFalse_(self); +self["@source"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self", +args: ["aString"], +source: "source: aString\x0a\x09source := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedIfFalse:"] +messageSends: [] }), -$globals.IRInlinedIfFalse); +$globals.AbstractCodeGenerator); -$core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction."; -//>>excludeEnd("ide"); +$core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core'); +$globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation."; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "compileNode:", +protocol: 'compiling', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ir,stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$recv(self._semanticAnalyzer())._visit_(aNode); +$ctx1.sendIdx["visit:"]=1; +ir=$recv(self._translator())._visit_(aNode); +$ctx1.sendIdx["visit:"]=2; +$2=self._irTranslator(); +$recv($2)._currentClass_(self._currentClass()); +$recv($2)._visit_(ir); +$3=$recv($2)._contents(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self", +args: ["aNode"], +source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedIfNilIfNotNil:"] +messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"] }), -$globals.IRInlinedIfNilIfNotNil); +$globals.CodeGenerator); $core.addMethod( $core.method({ -selector: "internalVariables", -protocol: 'accessing', +selector: "irTranslator", +protocol: 'compiling', fn: function (){ var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($Array())._with_(self._receiverInternalVariable()); +$1=$recv($IRJSTranslator())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["with:", "receiverInternalVariable"] +source: "irTranslator\x0a\x09^ IRJSTranslator new", +referencedClasses: ["IRJSTranslator"], +messageSends: ["new"] }), -$globals.IRInlinedIfNilIfNotNil); +$globals.CodeGenerator); $core.addMethod( $core.method({ -selector: "receiverInternalVariable", -protocol: 'accessing', +selector: "semanticAnalyzer", +protocol: 'compiling', fn: function (){ var self=this; -function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} -function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; -$2=$recv($IRVariable())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName())); +$2=$recv($SemanticAnalyzer())._on_(self._currentClass()); +$recv($2)._thePackage_(self._currentPackage()); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.", -referencedClasses: ["IRVariable", "AliasVar"], -//>>excludeEnd("ide"); -messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"] +source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself", +referencedClasses: ["SemanticAnalyzer"], +messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"] }), -$globals.IRInlinedIfNilIfNotNil); +$globals.CodeGenerator); $core.addMethod( $core.method({ -selector: "receiverInternalVariableName", -protocol: 'accessing', +selector: "translator", +protocol: 'compiling', fn: function (){ var self=this; -return "$receiver"; - +function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRASTTranslator())._new(); +$recv($2)._source_(self._source()); +$recv($2)._theClass_(self._currentClass()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "receiverInternalVariableName\x0a\x09^ '$receiver'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself", +referencedClasses: ["IRASTTranslator"], +messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"] }), -$globals.IRInlinedIfNilIfNotNil); +$globals.CodeGenerator); -$core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction."; -//>>excludeEnd("ide"); +$core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core'); +$globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`"; $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "codeGeneratorClass", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedIfTrue_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self["@codeGeneratorClass"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$InliningCodeGenerator(); +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedIfTrue:"] +args: [], +source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]", +referencedClasses: ["InliningCodeGenerator"], +messageSends: ["ifNil:"] }), -$globals.IRInlinedIfTrue); - - +$globals.Compiler); -$core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "codeGeneratorClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self); +self["@codeGeneratorClass"]=aClass; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self", +args: ["aClass"], +source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedIfTrueIfFalse:"] +messageSends: [] }), -$globals.IRInlinedIfTrueIfFalse); - - +$globals.Compiler); -$core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "accept:", -protocol: 'visiting', -fn: function (aVisitor){ +selector: "compile:forClass:protocol:", +protocol: 'compiling', +fn: function (aString,aClass,anotherString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aVisitor)._visitIRInlinedSequence_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)}); -//>>excludeEnd("ctx"); +var $2,$1; +self._source_(aString); +$2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString)); +$1=$2; +return $1; +}, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aVisitor"], -source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self", +args: ["aString", "aClass", "anotherString"], +source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitIRInlinedSequence:"] +messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"] }), -$globals.IRInlinedSequence); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "isInlined", -protocol: 'testing', -fn: function (){ +selector: "compileExpression:on:", +protocol: 'compiling', +fn: function (aString,anObject){ var self=this; -return true; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isInlined\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value"); +$ctx1.sendIdx[","]=1; +$1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)}); +}, +args: ["aString", "anObject"], +source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'", +referencedClasses: [], +messageSends: ["compile:forClass:protocol:", ",", "class"] }), -$globals.IRInlinedSequence); - - +$globals.Compiler); -$core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "assignmentInliner", -protocol: 'factory', -fn: function (){ +selector: "compileNode:", +protocol: 'compiling', +fn: function (aNode){ var self=this; -function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var generator,result; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRAssignmentInliner())._new(); -$recv($2)._translator_(self); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +var $1,$2,$3; +generator=$recv(self._codeGeneratorClass())._new(); +$1=generator; +$recv($1)._source_(self._source()); +$recv($1)._currentClass_(self._currentClass()); +$2=$recv($1)._currentPackage_(self._currentPackage()); +result=$recv(generator)._compileNode_(aNode); +self._unknownVariables_([]); +$3=result; +return $3; +}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", -referencedClasses: ["IRAssignmentInliner"], -//>>excludeEnd("ide"); -messageSends: ["translator:", "new", "yourself"] +args: ["aNode"], +source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result", +referencedClasses: [], +messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "returnInliner", -protocol: 'factory', -fn: function (){ +selector: "compileNode:forClass:package:", +protocol: 'compiling', +fn: function (aNode,aClass,aPackage){ var self=this; -function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRReturnInliner())._new(); -$recv($2)._translator_(self); -$3=$recv($2)._yourself(); -$1=$3; +var $2,$1; +self._currentClass_(aClass); +self._currentPackage_(aPackage); +$2=self._compileNode_(aNode); +$1=$2; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", -referencedClasses: ["IRReturnInliner"], -//>>excludeEnd("ide"); -messageSends: ["translator:", "new", "yourself"] +args: ["aNode", "aClass", "aPackage"], +source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode", +referencedClasses: [], +messageSends: ["currentClass:", "currentPackage:", "compileNode:"] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "sendInliner", -protocol: 'factory', +selector: "currentClass", +protocol: 'accessing', fn: function (){ var self=this; -function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($IRSendInliner())._new(); -$recv($2)._translator_(self); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=self["@currentClass"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", -referencedClasses: ["IRSendInliner"], -//>>excludeEnd("ide"); -messageSends: ["translator:", "new", "yourself"] +source: "currentClass\x0a\x09^ currentClass", +referencedClasses: [], +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "shouldInlineAssignment:", -protocol: 'testing', -fn: function (anIRAssignment){ +selector: "currentClass:", +protocol: 'accessing', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -$1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(anIRAssignment)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._isSend(); -return $recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +self["@currentClass"]=aClass; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRAssignment"], -source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]", +args: ["aClass"], +source: "currentClass: aClass\x0a\x09currentClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"] +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "shouldInlineReturn:", -protocol: 'testing', -fn: function (anIRReturn){ +selector: "currentPackage", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -$1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(anIRReturn)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["first"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._isSend(); -return $recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); +var $1; +$1=self["@currentPackage"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRReturn"], -source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]", +args: [], +source: "currentPackage\x0a\x09^ currentPackage", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"] +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "shouldInlineSend:", -protocol: 'testing', -fn: function (anIRSend){ +selector: "currentPackage:", +protocol: 'accessing', +fn: function (anObject){ var self=this; -function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($IRSendInliner())._shouldInline_(anIRSend); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +self["@currentPackage"]=anObject; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]", -referencedClasses: ["IRSendInliner"], -//>>excludeEnd("ide"); -messageSends: ["and:", "not", "isInlined", "shouldInline:"] +args: ["anObject"], +source: "currentPackage: anObject\x0a\x09currentPackage := anObject", +referencedClasses: [], +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "transformNonLocalReturn:", -protocol: 'visiting', -fn: function (anIRNonLocalReturn){ +selector: "eval:", +protocol: 'compiling', +fn: function (aString){ var self=this; -var localReturn; -function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$5,$6,$7,$8,$9; -$2=$recv(anIRNonLocalReturn)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._canInlineNonLocalReturns(); -if($core.assert($1)){ -$4=$recv(anIRNonLocalReturn)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._methodScope(); -$5=$recv(anIRNonLocalReturn)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=3; -//>>excludeEnd("ctx"); -$recv($3)._removeNonLocalReturn_($5); -$6=$recv($IRReturn())._new(); -$recv($6)._scope_($recv(anIRNonLocalReturn)._scope()); -$7=$recv($6)._yourself(); -localReturn=$7; -localReturn; -$recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(localReturn)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(anIRNonLocalReturn)._replaceWith_(localReturn); -$8=localReturn; -return $8; -}; -$9=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -return $9; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +return eval(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRNonLocalReturn"], -source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn", -referencedClasses: ["IRReturn"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"] +args: ["aString"], +source: "eval: aString\x0a\x09", +referencedClasses: [], +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRAssignment:", -protocol: 'visiting', -fn: function (anIRAssignment){ +selector: "eval:forPackage:", +protocol: 'compiling', +fn: function (aString,aPackage){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._shouldInlineAssignment_(anIRAssignment); -if($core.assert($2)){ -$1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment); -} else { -$1=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +return aPackage && aPackage.innerEval + ? aPackage.innerEval(aString) + : eval(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRAssignment"], -source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]", +args: ["aString", "aPackage"], +source: "eval: aString forPackage: aPackage\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"] +messageSends: [] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRNonLocalReturn:", -protocol: 'visiting', -fn: function (anIRNonLocalReturn){ +selector: "evaluateExpression:", +protocol: 'compiling', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._transformNonLocalReturn_(anIRNonLocalReturn); +$1=self._evaluateExpression_on_(aString,$recv($DoIt())._new()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRNonLocalReturn"], -source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["transformNonLocalReturn:"] +args: ["aString"], +source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new", +referencedClasses: ["DoIt"], +messageSends: ["evaluateExpression:on:", "new"] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRReturn:", -protocol: 'visiting', -fn: function (anIRReturn){ +selector: "evaluateExpression:on:", +protocol: 'compiling', +fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var result,method; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._shouldInlineReturn_(anIRReturn); -if($core.assert($2)){ -$1=$recv(self._returnInliner())._inlineReturn_(anIRReturn); -} else { -$1=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +var $1,$2; +method=self._eval_(self._compileExpression_on_(aString,anObject)); +$recv(method)._protocol_("**xxxDoIt"); +$1=$recv(anObject)._class(); +$ctx1.sendIdx["class"]=1; +$recv($1)._addCompiledMethod_(method); +result=$recv(anObject)._xxxDoIt(); +$recv($recv(anObject)._class())._removeCompiledMethod_(method); +$2=result; +return $2; +}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRReturn"], -source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]", +args: ["aString", "anObject"], +source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"] +messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"] }), -$globals.IRInliner); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRSend:", -protocol: 'visiting', -fn: function (anIRSend){ +selector: "install:forClass:protocol:", +protocol: 'compiling', +fn: function (aString,aBehavior,anotherString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var compiledMethod; +function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._shouldInlineSend_(anIRSend); -if($core.assert($2)){ -$1=$recv(self._sendInliner())._inlineSend_(anIRSend); -} else { -$1=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -}; +var $1; +compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString)); +$1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"] +args: ["aString", "aBehavior", "anotherString"], +source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString", +referencedClasses: ["ClassBuilder"], +messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"] }), -$globals.IRInliner); - +$globals.Compiler); +$core.addMethod( +$core.method({ +selector: "parse:", +protocol: 'compiling', +fn: function (aString){ +var self=this; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($Smalltalk())._parse_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)}); +}, +args: ["aString"], +source: "parse: aString\x0a\x09^ Smalltalk parse: aString", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:"] +}), +$globals.Compiler); -$core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "visitIRInlinedAssignment:", -protocol: 'visiting', -fn: function (anIRInlinedAssignment){ +selector: "parseExpression:", +protocol: 'compiling', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +var $2,$1; +$2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value"); +$ctx1.sendIdx[","]=1; +$1=self._parse_($2); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedAssignment"], -source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last", +args: ["aString"], +source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "last", "instructions"] +messageSends: ["parse:", ","] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedClosure:", -protocol: 'visiting', -fn: function (anIRInlinedClosure){ +selector: "recompile:", +protocol: 'compiling', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._name())._asVariableName(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))); -$recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +}),"Recompiling ".__comma($recv(aClass)._name())); +$1=$recv(aClass)._isMetaclass(); +if(!$core.assert($1)){ +self._recompile_($recv(aClass)._class()); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedClosure"], -source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]", +args: ["aClass"], +source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"] +messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedIfFalse:", -protocol: 'visiting', -fn: function (anIRInlinedIfFalse){ +selector: "recompileAll", +protocol: 'compiling', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutIf_with_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_("!$core.assert("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(anIRInlinedIfFalse)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._first(); -self._visit_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +return self._recompile_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),"Compiling all classes..."); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedIfFalse"], -source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"] +args: [], +source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'", +referencedClasses: ["Smalltalk"], +messageSends: ["do:displayingProgress:", "classes", "recompile:"] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedIfNilIfNotNil:", -protocol: 'visiting', -fn: function (anIRInlinedIfNilIfNotNil){ +selector: "source", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4,$7,$6; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutIfElse_with_with_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$5=$recv(anIRInlinedIfNilIfNotNil)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._first(); -self._visit_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$7=$recv(anIRInlinedIfNilIfNotNil)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._second(); -return self._visit_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self["@source"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=""; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedIfNilIfNotNil"], -source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]", +args: [], +source: "source\x0a\x09^ source ifNil: [ '' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"] +messageSends: ["ifNil:"] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedIfTrue:", -protocol: 'visiting', -fn: function (anIRInlinedIfTrue){ +selector: "source:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutIf_with_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_("$core.assert("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(anIRInlinedIfTrue)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._first(); -self._visit_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +self["@source"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedIfTrue"], -source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]", +args: ["aString"], +source: "source: aString\x0a\x09source := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"] +messageSends: [] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedIfTrueIfFalse:", -protocol: 'visiting', -fn: function (anIRInlinedIfTrueIfFalse){ +selector: "unknownVariables", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$6,$5; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutIfElse_with_with_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["stream"]=2; -//>>excludeEnd("ctx"); -$recv($2)._nextPutAll_("$core.assert("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(anIRInlinedIfTrueIfFalse)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._first(); -self._visit_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutAll_(")"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$6=$recv(anIRInlinedIfTrueIfFalse)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["instructions"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._second(); -return self._visit_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["visit:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@unknownVariables"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedIfTrueIfFalse"], -source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]", +args: [], +source: "unknownVariables\x0a\x09^ unknownVariables", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"] +messageSends: [] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); $core.addMethod( $core.method({ -selector: "visitIRInlinedNonLocalReturn:", -protocol: 'visiting', -fn: function (anIRInlinedReturn){ +selector: "unknownVariables:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._stream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stream"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutStatementWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv(self._stream())._nextPutNonLocalReturnWith_((function(){ - -})); +self["@unknownVariables"]=aCollection; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedReturn"], -source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]", +args: ["aCollection"], +source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"] +messageSends: [] }), -$globals.IRInliningJSTranslator); +$globals.Compiler); + $core.addMethod( $core.method({ -selector: "visitIRInlinedReturn:", -protocol: 'visiting', -fn: function (anIRInlinedReturn){ +selector: "recompile:", +protocol: 'compiling', +fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last()); +$recv(self._new())._recompile_(aClass); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedReturn"], -source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last", +args: ["aClass"], +source: "recompile: aClass\x0a\x09self new recompile: aClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "last", "instructions"] +messageSends: ["recompile:", "new"] }), -$globals.IRInliningJSTranslator); +$globals.Compiler.klass); $core.addMethod( $core.method({ -selector: "visitIRInlinedSequence:", -protocol: 'visiting', -fn: function (anIRInlinedSequence){ +selector: "recompileAll", +protocol: 'compiling', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv($recv($Smalltalk())._classes())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._stream())._nextPutStatementWith_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._visit_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._recompile_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInlinedSequence"], -source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"] +args: [], +source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]", +referencedClasses: ["Smalltalk"], +messageSends: ["do:", "classes", "recompile:"] }), -$globals.IRInliningJSTranslator); +$globals.Compiler.klass); +$core.addClass('DoIt', $globals.Object, [], 'Compiler-Core'); +$globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`."; -$core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."; -//>>excludeEnd("ide"); + +$core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core'); +$globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver."; $core.addMethod( $core.method({ -selector: "ifFalse:", -protocol: 'inlining', -fn: function (anIRInstruction){ +selector: "evaluate:context:", +protocol: 'evaluating', +fn: function (aString,aContext){ +var self=this; +var compiler,ast; +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +var $early={}; +try { +compiler=$recv($Compiler())._new(); +$recv((function(){ +return $core.withContext(function($ctx2) { +ast=$recv(compiler)._parseExpression_(aString); +return ast; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(ex){ +return $core.withContext(function($ctx2) { +$1=self._alert_($recv(ex)._messageText()); +throw $early=[$1]; +}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)}); +})); +$2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class()); +$recv($2)._context_(aContext); +$3=$recv($2)._visit_(ast); +$4=$recv(aContext)._evaluateNode_(ast); +return $4; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)}); +}, +args: ["aString", "aContext"], +source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast", +referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"], +messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"] +}), +$globals.Evaluator); + +$core.addMethod( +$core.method({ +selector: "evaluate:for:", +protocol: 'evaluating', +fn: function (aString,anObject){ var self=this; -function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction); +$1=$recv(anObject)._evaluate_on_(aString,self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction", -referencedClasses: ["IRInlinedIfFalse"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:", "new"] +args: ["aString", "anObject"], +source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self", +referencedClasses: [], +messageSends: ["evaluate:on:"] }), -$globals.IRSendInliner); +$globals.Evaluator); $core.addMethod( $core.method({ -selector: "ifFalse:ifTrue:", -protocol: 'inlining', -fn: function (anIRInstruction,anotherIRInstruction){ +selector: "evaluate:receiver:", +protocol: 'evaluating', +fn: function (aString,anObject){ +var self=this; +var compiler; +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $core.withContext(function($ctx1) { +var $1,$2; +var $early={}; +try { +compiler=$recv($Compiler())._new(); +$recv((function(){ +return $core.withContext(function($ctx2) { +return $recv(compiler)._parseExpression_(aString); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(ex){ +return $core.withContext(function($ctx2) { +$1=self._alert_($recv(ex)._messageText()); +throw $early=[$1]; +}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)}); +})); +$2=$recv(compiler)._evaluateExpression_on_(aString,anObject); +return $2; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)}); +}, +args: ["aString", "anObject"], +source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject", +referencedClasses: ["Compiler", "Error"], +messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"] +}), +$globals.Evaluator); + + +$core.addMethod( +$core.method({ +selector: "evaluate:for:", +protocol: 'instance creation', +fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]); +$1=$recv(self._new())._evaluate_for_(aString,anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction", "anotherIRInstruction"], -source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }", +args: ["aString", "anObject"], +source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["perform:withArguments:"] +messageSends: ["evaluate:for:", "new"] }), -$globals.IRSendInliner); +$globals.Evaluator.klass); + +$core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core'); +$globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors."; $core.addMethod( $core.method({ -selector: "ifNil:", -protocol: 'inlining', -fn: function (anIRInstruction){ +selector: "visit:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} -function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} -function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$4,$5,$7,$8,$6,$9,$3,$1; -$2=$recv($IRInlinedIfNilIfNotNil())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$4=$recv($IRClosure())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy()); -$5=$4; -$7=$recv($IRBlockSequence())._new(); -$recv($7)._add_($recv($recv(self._send())._instructions())._first()); -$8=$recv($7)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$6=$8; -$recv($5)._add_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$9=$recv($4)._yourself(); -$3=$9; -$1=self._inlinedSend_with_with_($2,anIRInstruction,$3); +var $1; +$1=$recv(aNode)._accept_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)", -referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"] +args: ["aNode"], +source: "visit: aNode\x0a\x09^ aNode accept: self", +referencedClasses: [], +messageSends: ["accept:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "ifNil:ifNotNil:", -protocol: 'inlining', -fn: function (anIRInstruction,anotherIRInstruction){ +selector: "visitAll:", +protocol: 'visiting', +fn: function (aCollection){ var self=this; -function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction); +$1=$recv(aCollection)._collect_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction", "anotherIRInstruction"], -source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction", -referencedClasses: ["IRInlinedIfNilIfNotNil"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:with:", "new"] +args: ["aCollection"], +source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]", +referencedClasses: [], +messageSends: ["collect:", "visit:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "ifNotNil:", -protocol: 'inlining', -fn: function (anIRInstruction){ +selector: "visitAssignmentNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} -function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} -function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$4,$5,$7,$8,$6,$9,$3,$1; -$2=$recv($IRInlinedIfNilIfNotNil())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$4=$recv($IRClosure())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy()); -$5=$4; -$7=$recv($IRBlockSequence())._new(); -$recv($7)._add_($recv($recv(self._send())._instructions())._first()); -$8=$recv($7)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$6=$8; -$recv($5)._add_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$9=$recv($4)._yourself(); -$3=$9; -$1=self._inlinedSend_with_with_($2,$3,anIRInstruction); +var $1; +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction", -referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"] +args: ["aNode"], +source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "ifNotNil:ifNil:", -protocol: 'inlining', -fn: function (anIRInstruction,anotherIRInstruction){ +selector: "visitBlockNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction); +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction", "anotherIRInstruction"], -source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction", -referencedClasses: ["IRInlinedIfNilIfNotNil"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:with:", "new"] +args: ["aNode"], +source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "ifTrue:", -protocol: 'inlining', -fn: function (anIRInstruction){ +selector: "visitBlockSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction); +$1=self._visitSequenceNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction", -referencedClasses: ["IRInlinedIfTrue"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:", "new"] +args: ["aNode"], +source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode", +referencedClasses: [], +messageSends: ["visitSequenceNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "ifTrue:ifFalse:", -protocol: 'inlining', -fn: function (anIRInstruction,anotherIRInstruction){ +selector: "visitCascadeNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction); +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction", "anotherIRInstruction"], -source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction", -referencedClasses: ["IRInlinedIfTrueIfFalse"], -//>>excludeEnd("ide"); -messageSends: ["inlinedSend:with:with:", "new"] +args: ["aNode"], +source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlineClosure:", -protocol: 'inlining', -fn: function (anIRClosure){ +selector: "visitDynamicArrayNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var inlinedClosure,sequence,statements; -function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} -function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} -function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} -function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37; -inlinedClosure=self._inlinedClosure(); -$1=inlinedClosure; -$2=$1; -$3=$recv(anIRClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$recv($2)._scope_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope:"]=1; -//>>excludeEnd("ctx"); -$4=$recv($1)._parent_($recv(anIRClosure)._parent()); -$recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(inlinedClosure)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -sequence=self._inlinedSequence(); -$recv($recv(anIRClosure)._arguments())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$5=inlinedClosure; -$7=$recv($IRTempDeclaration())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($7)._name_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["name:"]=1; -//>>excludeEnd("ctx"); -$8=$recv($7)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$6=$8; -$recv($5)._add_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$9=sequence; -$11=$recv($IRAssignment())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$12=$11; -$14=$recv($IRVariable())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$16=$recv($AliasVar())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -$17=$16; -$18=$recv(inlinedClosure)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$recv($17)._scope_($18); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["scope:"]=2; -//>>excludeEnd("ctx"); -$recv($16)._name_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["name:"]=2; -//>>excludeEnd("ctx"); -$19=$recv($16)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$15=$19; -$13=$recv($14)._variable_($15); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["variable:"]=1; -//>>excludeEnd("ctx"); -$recv($12)._add_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=4; -//>>excludeEnd("ctx"); -$20=$11; -$22=$recv($IRVariable())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=5; -//>>excludeEnd("ctx"); -$24=$recv($AliasVar())._new(); -$recv($24)._scope_($recv(inlinedClosure)._scope()); -$recv($24)._name_("$receiver"); -$25=$recv($24)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -$23=$25; -$21=$recv($22)._variable_($23); -$recv($20)._add_($21); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=5; -//>>excludeEnd("ctx"); -$26=$recv($11)._yourself(); -$10=$26; -return $recv($9)._add_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=2; -//>>excludeEnd("ctx"); -$recv(inlinedClosure)._add_(sequence); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=6; -//>>excludeEnd("ctx"); -$28=$recv(anIRClosure)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=2; -//>>excludeEnd("ctx"); -$27=$recv($28)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -statements=$recv($27)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv(statements)._ifNotEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv($recv(statements)._allButLast())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(sequence)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["add:"]=7; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)}); -//>>excludeEnd("ctx"); -})); -$31=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=2; -//>>excludeEnd("ctx"); -$30=$recv($31)._isReturn(); -$29=$recv($30)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$32=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["last"]=3; -//>>excludeEnd("ctx"); -return $recv($32)._isBlockReturn(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($29)){ -$33=sequence; -$36=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=4; -//>>excludeEnd("ctx"); -$35=$recv($36)._instructions(); -$34=$recv($35)._first(); -return $recv($33)._add_($34); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=8; -//>>excludeEnd("ctx"); -} else { -return $recv(sequence)._add_($recv(statements)._last()); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$37=inlinedClosure; -return $37; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._visitNode_(aNode); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure"], -source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure", -referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"], -//>>excludeEnd("ide"); -messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"] +args: ["aNode"], +source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlineSend:", -protocol: 'inlining', -fn: function (anIRSend){ +selector: "visitDynamicDictionaryNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -self._send_(anIRSend); -$3=self._send(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["send"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._selector(); -$1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst()); +var $1; +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst", +args: ["aNode"], +source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlinedClosure", -protocol: 'factory', -fn: function (){ +selector: "visitJSStatementNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($IRInlinedClosure())._new(); +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "inlinedClosure\x0a\x09^ IRInlinedClosure new", -referencedClasses: ["IRInlinedClosure"], -//>>excludeEnd("ide"); -messageSends: ["new"] +args: ["aNode"], +source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlinedSend:with:", -protocol: 'inlining', -fn: function (inlinedSend,anIRInstruction){ +selector: "visitMethodNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var inlinedClosure; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$5,$4,$3,$6,$7; -$1=$recv(anIRInstruction)._isClosure(); -if(!$core.assert($1)){ -self._inliningError_("Message argument should be a block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["inliningError:"]=1; -//>>excludeEnd("ctx"); -}; -$2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0)); -if(!$core.assert($2)){ -self._inliningError_("Inlined block should have zero argument"); -}; -inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction)); -$5=self._send(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["send"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._instructions(); -$3=$recv($4)._first(); -$recv(inlinedSend)._add_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$6=$recv(inlinedSend)._add_(inlinedClosure); -$recv(self._send())._replaceWith_(inlinedSend); -$7=$recv($recv(inlinedSend)._method())._internalVariables(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["internalVariables"]=1; -//>>excludeEnd("ctx"); -$recv($7)._addAll_($recv(inlinedSend)._internalVariables()); -return inlinedSend; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._visitNode_(aNode); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["inlinedSend", "anIRInstruction"], -source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend", +args: ["aNode"], +source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlinedSend:with:with:", -protocol: 'inlining', -fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){ +selector: "visitNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var inlinedClosure1,inlinedClosure2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$7,$6,$5,$8,$9; -$1=$recv(anIRInstruction)._isClosure(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isClosure"]=1; -//>>excludeEnd("ctx"); -if(!$core.assert($1)){ -self._inliningError_("Message argument should be a block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["inliningError:"]=1; -//>>excludeEnd("ctx"); -}; -$2=$recv(anotherIRInstruction)._isClosure(); -if(!$core.assert($2)){ -self._inliningError_("Message argument should be a block"); -}; -$3=self._translator(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["translator"]=1; -//>>excludeEnd("ctx"); -$4=self._inlineClosure_(anIRInstruction); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["inlineClosure:"]=1; -//>>excludeEnd("ctx"); -inlinedClosure1=$recv($3)._visit_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction)); -$7=self._send(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["send"]=1; -//>>excludeEnd("ctx"); -$6=$recv($7)._instructions(); -$5=$recv($6)._first(); -$recv(inlinedSend)._add_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv(inlinedSend)._add_(inlinedClosure1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$8=$recv(inlinedSend)._add_(inlinedClosure2); -$recv(self._send())._replaceWith_(inlinedSend); -$9=$recv($recv(inlinedSend)._method())._internalVariables(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["internalVariables"]=1; -//>>excludeEnd("ctx"); -$recv($9)._addAll_($recv(inlinedSend)._internalVariables()); -return inlinedSend; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._visitAll_($recv(aNode)._nodes()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"], -source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend", +args: ["aNode"], +source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"] +messageSends: ["visitAll:", "nodes"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlinedSequence", -protocol: 'factory', -fn: function (){ +selector: "visitReturnNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($IRInlinedSequence())._new(); +$1=self._visitNode_(aNode); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "inlinedSequence\x0a\x09^ IRInlinedSequence new", -referencedClasses: ["IRInlinedSequence"], -//>>excludeEnd("ide"); -messageSends: ["new"] +args: ["aNode"], +source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode", +referencedClasses: [], +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inliningError:", -protocol: 'error handling', -fn: function (aString){ +selector: "visitSendNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($InliningError())._signal_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "inliningError: aString\x0a\x09InliningError signal: aString", -referencedClasses: ["InliningError"], -//>>excludeEnd("ide"); -messageSends: ["signal:"] -}), -$globals.IRSendInliner); - -$core.addMethod( -$core.method({ -selector: "send", -protocol: 'accessing', -fn: function (){ -var self=this; var $1; -$1=self["@send"]; +$1=self._visitNode_(aNode); return $1; - +}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "send\x0a\x09^ send", +args: ["aNode"], +source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "send:", -protocol: 'accessing', -fn: function (anIRSend){ +selector: "visitSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -self["@send"]=anIRSend; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitNode_(aNode); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRSend"], -source: "send: anIRSend\x0a\x09send := anIRSend", +args: ["aNode"], +source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "translator", -protocol: 'accessing', -fn: function (){ +selector: "visitValueNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@translator"]; +$1=self._visitNode_(aNode); return $1; - +}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "translator\x0a\x09^ translator", +args: ["aNode"], +source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "translator:", -protocol: 'accessing', -fn: function (anASTTranslator){ +selector: "visitVariableNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -self["@translator"]=anASTTranslator; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitNode_(aNode); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anASTTranslator"], -source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator", +args: ["aNode"], +source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitNode:"] }), -$globals.IRSendInliner); +$globals.NodeVisitor); $core.addMethod( $core.method({ -selector: "inlinedSelectors", -protocol: 'accessing', +selector: "asVariableName", +protocol: '*Compiler-Core', fn: function (){ var self=this; -var $1; -$1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv($recv($Smalltalk())._reservedWords())._includes_(self); +if($core.assert($2)){ +$1=self.__comma("_"); +} else { +$1=self; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]", +referencedClasses: ["Smalltalk"], +messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","] }), -$globals.IRSendInliner.klass); +$globals.String); -$core.addMethod( -$core.method({ -selector: "shouldInline:", -protocol: 'accessing', -fn: function (anIRInstruction){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -$1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector()); -if(!$core.assert($1)){ -return false; -}; -$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(each)._isClosure(); -if(!$core.assert($2)){ -throw $early=[false]; -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return true; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"] -}), -$globals.IRSendInliner.klass); +}); +define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-AST'); +$core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"}; -$core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};"; -//>>excludeEnd("ide"); +$core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST'); +$globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file."; $core.addMethod( $core.method({ -selector: "assignment", -protocol: 'accessing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@assignment"]; +$1=$recv(aVisitor)._visitNode_(self); return $1; - +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "assignment\x0a\x09^ assignment", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitNode:"] }), -$globals.IRAssignmentInliner); +$globals.Node); $core.addMethod( $core.method({ -selector: "assignment:", +selector: "addNode:", protocol: 'accessing', fn: function (aNode){ var self=this; -self["@assignment"]=aNode; +return $core.withContext(function($ctx1) { +$recv(self._nodes())._add_(aNode); +$recv(aNode)._parent_(self); return self; - +}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], -source: "assignment: aNode\x0a\x09assignment := aNode", +source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["add:", "nodes", "parent:"] }), -$globals.IRAssignmentInliner); +$globals.Node); $core.addMethod( $core.method({ -selector: "inlineAssignment:", -protocol: 'inlining', -fn: function (anIRAssignment){ +selector: "allNodes", +protocol: 'accessing', +fn: function (){ var self=this; -var inlinedAssignment; -function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var allNodes; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; -self._assignment_(anIRAssignment); -inlinedAssignment=$recv($IRInlinedAssignment())._new(); -$1=$recv(anIRAssignment)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv($1)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=self._nodes(); +$ctx1.sendIdx["nodes"]=1; +allNodes=$recv($1)._asSet(); +$recv(self._nodes())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(inlinedAssignment)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(allNodes)._addAll_($recv(each)._allNodes()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -$recv(anIRAssignment)._replaceWith_(inlinedAssignment); -self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last()); -$2=inlinedAssignment; +$2=allNodes; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRAssignment"], -source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment", -referencedClasses: ["IRInlinedAssignment"], -//>>excludeEnd("ide"); -messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"] +args: [], +source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes", +referencedClasses: [], +messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"] }), -$globals.IRAssignmentInliner); +$globals.Node); $core.addMethod( $core.method({ -selector: "inlineClosure:", -protocol: 'inlining', -fn: function (anIRClosure){ +selector: "inPosition:", +protocol: 'testing', +fn: function (aPoint){ var self=this; -var inlinedClosure,statements; -function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$5,$7,$8,$6,$9; -inlinedClosure=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=$recv(inlinedClosure)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -statements=$recv($1)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv(statements)._ifNotEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._canBeAssigned(); -if($core.assert($3)){ -$5=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=3; -//>>excludeEnd("ctx"); -$7=$recv($IRAssignment())._new(); -$recv($7)._add_($recv($recv(self._assignment())._instructions())._first()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv($7)._add_($recv($recv(statements)._last())._copy()); -$8=$recv($7)._yourself(); -$6=$8; -return $recv($5)._replaceWith_($6); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._positionEnd()).__gt_eq(aPoint); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -$9=inlinedClosure; -return $9; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure"], -source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure", -referencedClasses: ["IRAssignment"], -//>>excludeEnd("ide"); -messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"] +args: ["aPoint"], +source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])", +referencedClasses: [], +messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"] }), -$globals.IRAssignmentInliner); - - +$globals.Node); -$core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "inlineClosure:", -protocol: 'inlining', -fn: function (anIRClosure){ +selector: "isAssignmentNode", +protocol: 'testing', +fn: function (){ var self=this; -var closure,statements; -function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$5,$6,$7; -closure=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=$recv($recv(closure)._instructions())._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -statements=$recv($1)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv(statements)._ifNotEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$3=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=2; -//>>excludeEnd("ctx"); -$2=$recv($3)._isReturn(); -if(!$core.assert($2)){ -$4=$recv(statements)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["last"]=3; -//>>excludeEnd("ctx"); -$5=$recv($IRReturn())._new(); -$recv($5)._add_($recv($recv(statements)._last())._copy()); -$6=$recv($5)._yourself(); -return $recv($4)._replaceWith_($6); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$7=closure; -return $7; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRClosure"], -source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure", -referencedClasses: ["IRReturn"], -//>>excludeEnd("ide"); -messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"] -}), -$globals.IRReturnInliner); +return false; -$core.addMethod( -$core.method({ -selector: "inlineReturn:", -protocol: 'inlining', -fn: function (anIRReturn){ -var self=this; -var return_; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -return_=self._inlinedReturn(); -$1=$recv(anIRReturn)._instructions(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instructions"]=1; -//>>excludeEnd("ctx"); -$recv($1)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(return_)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv(anIRReturn)._replaceWith_(return_); -self._inlineSend_($recv($recv(return_)._instructions())._last()); -$2=return_; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRReturn"], -source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return", +args: [], +source: "isAssignmentNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"] +messageSends: [] }), -$globals.IRReturnInliner); +$globals.Node); $core.addMethod( $core.method({ -selector: "inlinedReturn", -protocol: 'factory', +selector: "isBlockNode", +protocol: 'testing', fn: function (){ var self=this; -function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($IRInlinedReturn())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "inlinedReturn\x0a\x09^ IRInlinedReturn new", -referencedClasses: ["IRInlinedReturn"], -//>>excludeEnd("ide"); -messageSends: ["new"] +source: "isBlockNode\x0a\x09^ false", +referencedClasses: [], +messageSends: [] }), -$globals.IRReturnInliner); - - +$globals.Node); -$core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "compileNode:", -protocol: 'compiling', -fn: function (aNode){ +selector: "isBlockSequenceNode", +protocol: 'testing', +fn: function (){ var self=this; -var ir,stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$recv(self._semanticAnalyzer())._visit_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -ir=$recv(self._translator())._visit_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=2; -//>>excludeEnd("ctx"); -$recv(self._inliner())._visit_(ir); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=3; -//>>excludeEnd("ctx"); -$2=self._irTranslator(); -$recv($2)._currentClass_(self._currentClass()); -$recv($2)._visit_(ir); -$3=$recv($2)._contents(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents", +args: [], +source: "isBlockSequenceNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"] +messageSends: [] }), -$globals.InliningCodeGenerator); +$globals.Node); $core.addMethod( $core.method({ -selector: "inliner", -protocol: 'compiling', +selector: "isCascadeNode", +protocol: 'testing', fn: function (){ var self=this; -function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($IRInliner())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "inliner\x0a\x09^ IRInliner new", -referencedClasses: ["IRInliner"], -//>>excludeEnd("ide"); -messageSends: ["new"] +source: "isCascadeNode\x0a\x09^ false", +referencedClasses: [], +messageSends: [] }), -$globals.InliningCodeGenerator); +$globals.Node); $core.addMethod( $core.method({ -selector: "irTranslator", -protocol: 'compiling', +selector: "isImmutable", +protocol: 'testing', fn: function (){ var self=this; -function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($IRInliningJSTranslator())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "irTranslator\x0a\x09^ IRInliningJSTranslator new", -referencedClasses: ["IRInliningJSTranslator"], -//>>excludeEnd("ide"); -messageSends: ["new"] +source: "isImmutable\x0a\x09^ false", +referencedClasses: [], +messageSends: [] }), -$globals.InliningCodeGenerator); - - -}); - -define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Semantic'); -$core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$globals.Node); -$core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "addArg:", -protocol: 'adding', -fn: function (aString){ +selector: "isJSStatementNode", +protocol: 'testing', +fn: function (){ var self=this; -function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._args(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["args"]=1; -//>>excludeEnd("ctx"); -$recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString)); -$recv($recv(self._args())._at_(aString))._scope_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self", -referencedClasses: ["ArgVar"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "args", "on:", "scope:", "at:"] -}), -$globals.LexicalScope); +return false; -$core.addMethod( -$core.method({ -selector: "addTemp:", -protocol: 'adding', -fn: function (aString){ -var self=this; -function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._temps(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["temps"]=1; -//>>excludeEnd("ctx"); -$recv($1)._at_put_(aString,$recv($TempVar())._on_(aString)); -$recv($recv(self._temps())._at_(aString))._scope_(self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self", -referencedClasses: ["TempVar"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "temps", "on:", "scope:", "at:"] +args: [], +source: "isJSStatementNode\x0a\x09^ false", +referencedClasses: [], +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "alias", -protocol: 'accessing', +selector: "isLastChild", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1="$ctx".__comma($recv(self._scopeLevel())._asString()); +$1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "alias\x0a\x09^ '$ctx', self scopeLevel asString", +source: "isLastChild\x0a\x09^ self parent nodes last = self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "asString", "scopeLevel"] +messageSends: ["=", "last", "nodes", "parent"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "allVariableNames", -protocol: 'accessing', +selector: "isNavigationNode", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv(self._args())._keys(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["keys"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma($recv(self._temps())._keys()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "allVariableNames\x0a\x09^ self args keys, self temps keys", +source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "keys", "args", "temps"] +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "args", -protocol: 'accessing', +selector: "isNode", +protocol: 'testing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@args"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@args"]=$recv($Dictionary())._new(); -$1=self["@args"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "isNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "bindingFor:", -protocol: 'accessing', -fn: function (aStringOrNode){ +selector: "isReferenced", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1; -$2=self._pseudoVars(); -$3=$recv(aStringOrNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._at_ifAbsent_($3,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $4,$3,$2,$1; +$4=self._parent(); +$ctx1.sendIdx["parent"]=1; +$3=$recv($4)._isSequenceNode(); +$2=$recv($3)._or_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=self._args(); -$5=$recv(aStringOrNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["value"]=2; -//>>excludeEnd("ctx"); -return $recv($4)._at_ifAbsent_($5,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){ -return nil; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:ifAbsent:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._parent())._isAssignmentNode(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=1; -//>>excludeEnd("ctx"); +$1=$recv($2)._not(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStringOrNode"], -source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]", +args: [], +source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"] +messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "blockIndex", -protocol: 'accessing', +selector: "isReturnNode", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@blockIndex"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=(0); -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]", +source: "isReturnNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "blockIndex:", -protocol: 'accessing', -fn: function (anInteger){ +selector: "isSendNode", +protocol: 'testing', +fn: function (){ var self=this; -self["@blockIndex"]=anInteger; -return self; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInteger"], -source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger", +args: [], +source: "isSendNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "canInlineNonLocalReturns", +selector: "isSequenceNode", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._isInlined())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._outerScope())._canInlineNonLocalReturns(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]", +source: "isSequenceNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"] +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "instruction", -protocol: 'accessing', +selector: "isValueNode", +protocol: 'testing', fn: function (){ var self=this; -var $1; -$1=self["@instruction"]; -return $1; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "instruction\x0a\x09^ instruction", +source: "isValueNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "instruction:", -protocol: 'accessing', -fn: function (anIRInstruction){ +selector: "isVariableNode", +protocol: 'testing', +fn: function (){ var self=this; -self["@instruction"]=anIRInstruction; -return self; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anIRInstruction"], -source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction", +args: [], +source: "isVariableNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "isBlockScope", -protocol: 'testing', +selector: "method", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._isMethodScope())._not(); +var $2,$1,$receiver; +$2=self._parent(); +if(($receiver = $2) == null || $receiver.isNil){ +$1=$2; +} else { +var node; +node=$receiver; +$1=$recv(node)._method(); +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isBlockScope\x0a\x09^ self isMethodScope not", +source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["not", "isMethodScope"] +messageSends: ["ifNotNil:", "parent", "method"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "isInlined", -protocol: 'testing', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -$3=self._instruction(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instruction"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._notNil(); -$1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +selector: "navigationNodeAt:ifAbsent:", +protocol: 'accessing', +fn: function (aPoint,aBlock){ +var self=this; +var children; +return $core.withContext(function($ctx1) { +var $1,$4,$3,$2; +var $early={}; +try { +children=$recv(self._allNodes())._select_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._instruction())._isInlined(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); +return $recv($recv(each)._isNavigationNode())._and_((function(){ +return $core.withContext(function($ctx3) { +return $recv(each)._inPosition_(aPoint); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); })); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["and:", "notNil", "instruction", "isInlined"] -}), -$globals.LexicalScope); - -$core.addMethod( -$core.method({ -selector: "isMethodScope", -protocol: 'testing', -fn: function (){ -var self=this; -return false; - +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(children)._ifEmpty_((function(){ +return $core.withContext(function($ctx2) { +$1=$recv(aBlock)._value(); +throw $early=[$1]; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){ +return $core.withContext(function($ctx2) { +$4=$recv(a)._positionStart(); +$ctx2.sendIdx["positionStart"]=1; +$3=$recv($4)._dist_(aPoint); +$ctx2.sendIdx["dist:"]=1; +return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint)); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)}); +})))._first(); +return $2; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isMethodScope\x0a\x09^ false", +args: ["aPoint", "aBlock"], +source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "lookupVariable:", +selector: "nextChild", protocol: 'accessing', -fn: function (aNode){ +fn: function (){ var self=this; -var lookup; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$receiver; -lookup=self._bindingFor_(aNode); -$1=lookup; -if(($receiver = $1) == null || $receiver.isNil){ -$2=self._outerScope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["outerScope"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $2) == null || $receiver.isNil){ -lookup=$2; -} else { -lookup=$recv(self._outerScope())._lookupVariable_(aNode); -}; -lookup; +var $3,$2,$1; +$3=self._nodes(); +$ctx1.sendIdx["nodes"]=1; +$2=$recv($3)._isEmpty(); +if($core.assert($2)){ +$1=self; } else { -$1; +$1=$recv($recv(self._nodes())._first())._nextChild(); }; -$3=lookup; -return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup", +args: [], +source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"] +messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "methodScope", +selector: "nextNode", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self._outerScope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["outerScope"]=1; -//>>excludeEnd("ctx"); +$2=self._parent(); if(($receiver = $2) == null || $receiver.isNil){ $1=$2; } else { -$1=$recv(self._outerScope())._methodScope(); +var node; +node=$receiver; +$1=$recv(node)._nextNode_(self); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "outerScope", "methodScope"] -}), -$globals.LexicalScope); - -$core.addMethod( -$core.method({ -selector: "node", -protocol: 'accessing', -fn: function (){ -var self=this; -var $1; -$1=self["@node"]; -return $1; - +}, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node", +source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNotNil:", "parent", "nextNode:"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "node:", +selector: "nextNode:", protocol: 'accessing', fn: function (aNode){ var self=this; -self["@node"]=aNode; -return self; +var next; +return $core.withContext(function($ctx1) { +var $1,$2; +var $early={}; +try { +$1=self._nodes(); +$ctx1.sendIdx["nodes"]=1; +next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){ +throw $early=[self]; +})); +$2=$recv(next)._nextChild(); +return $2; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], -source: "node: aNode\x0a\x09node := aNode", +source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "outerScope", +selector: "nodes", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@outerScope"]; +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@nodes"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@nodes"]=$recv($Array())._new(); +$1=self["@nodes"]; +} else { +$1=$2; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "outerScope\x0a\x09^ outerScope", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]", +referencedClasses: ["Array"], +messageSends: ["ifNil:", "new"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "outerScope:", -protocol: 'accessing', -fn: function (aLexicalScope){ +selector: "nodes:", +protocol: 'building', +fn: function (aCollection){ var self=this; -self["@outerScope"]=aLexicalScope; +return $core.withContext(function($ctx1) { +self["@nodes"]=aCollection; +$recv(aCollection)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._parent_(self); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); return self; - +}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aLexicalScope"], -source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope", +args: ["aCollection"], +source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["do:", "parent:"] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "pseudoVars", +selector: "parent", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._methodScope())._pseudoVars(); +$1=self["@parent"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "pseudoVars\x0a\x09^ self methodScope pseudoVars", +source: "parent\x0a\x09^ parent", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["pseudoVars", "methodScope"] +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "scopeLevel", +selector: "parent:", protocol: 'accessing', -fn: function (){ +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$5,$receiver; -$1=self._outerScope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["outerScope"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $1) == null || $receiver.isNil){ -return (1); -} else { -$1; -}; -$2=self._isInlined(); -if($core.assert($2)){ -$4=self._outerScope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["outerScope"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._scopeLevel(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scopeLevel"]=1; -//>>excludeEnd("ctx"); -return $3; -}; -$5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1)); -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +self["@parent"]=aNode; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1", +args: ["aNode"], +source: "parent: aNode\x0a\x09parent := aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"] +messageSends: [] }), -$globals.LexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "temps", +selector: "position", protocol: 'accessing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@temps"]; +var $2,$3,$1,$receiver; +$2=self["@position"]; if(($receiver = $2) == null || $receiver.isNil){ -self["@temps"]=$recv($Dictionary())._new(); -$1=self["@temps"]; +$3=self._parent(); +if(($receiver = $3) == null || $receiver.isNil){ +$1=$3; +} else { +var node; +node=$receiver; +$1=$recv(node)._position(); +}; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]", +referencedClasses: [], +messageSends: ["ifNil:", "ifNotNil:", "parent", "position"] }), -$globals.LexicalScope); - - +$globals.Node); -$core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.MethodLexicalScope.comment="I represent a method scope."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "addIVar:", -protocol: 'adding', -fn: function (aString){ +selector: "position:", +protocol: 'accessing', +fn: function (aPosition){ var self=this; -function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._iVars(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["iVars"]=1; -//>>excludeEnd("ctx"); -$recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString)); -$recv($recv(self._iVars())._at_(aString))._scope_(self); +self["@position"]=aPosition; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self", -referencedClasses: ["InstanceVar"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"] -}), -$globals.MethodLexicalScope); -$core.addMethod( -$core.method({ -selector: "addNonLocalReturn:", -protocol: 'adding', -fn: function (aScope){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._nonLocalReturns())._add_(aScope); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope", +args: ["aPosition"], +source: "position: aPosition\x0a\x09position := aPosition", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "nonLocalReturns"] +messageSends: [] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "allVariableNames", +selector: "positionEnd", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=$recv($2).__comma($recv(self._iVars())._keys()); +var $2,$7,$6,$5,$4,$3,$1; +$2=self._positionStart(); +$7=self._source(); +$ctx1.sendIdx["source"]=1; +$6=$recv($7)._lines(); +$ctx1.sendIdx["lines"]=1; +$5=$recv($6)._size(); +$ctx1.sendIdx["size"]=1; +$4=$recv($5).__minus((1)); +$ctx1.sendIdx["-"]=1; +$3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1))); +$1=$recv($2).__plus($3); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys", +source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "allVariableNames", "keys", "iVars"] +messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "bindingFor:", +selector: "positionStart", protocol: 'accessing', -fn: function (aNode){ +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -if(($receiver = $2) == null || $receiver.isNil){ -$1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){ -return nil; - -})); -} else { -$1=$2; -}; +var $1; +$1=self._position(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"] -}), -$globals.MethodLexicalScope); - -$core.addMethod( -$core.method({ -selector: "canInlineNonLocalReturns", -protocol: 'testing', -fn: function (){ -var self=this; -return true; - +}, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "canInlineNonLocalReturns\x0a\x09^ true", +source: "positionStart\x0a\x09^ self position", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["position"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "hasLocalReturn", -protocol: 'testing', +selector: "postCopy", +protocol: 'copying', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._localReturn(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +( +$ctx1.supercall = true, +$globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), [])); +$ctx1.supercall = false; +$recv(self._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._parent_(self); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "hasLocalReturn\x0a\x09^ self localReturn", +source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["localReturn"] +messageSends: ["postCopy", "do:", "nodes", "parent:"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "hasNonLocalReturn", +selector: "requiresSmalltalkContext", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._nonLocalReturns())._notEmpty(); +$1=$recv($recv(self._nodes())._detect_ifNone_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._requiresSmalltalkContext(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return nil; + +})))._notNil(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty", +source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["notEmpty", "nonLocalReturns"] +messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "iVars", +selector: "shouldBeAliased", protocol: 'accessing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@iVars"]; +$2=self["@shouldBeAliased"]; if(($receiver = $2) == null || $receiver.isNil){ -self["@iVars"]=$recv($Dictionary())._new(); -$1=self["@iVars"]; +$1=false; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]", +referencedClasses: [], +messageSends: ["ifNil:"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "isMethodScope", -protocol: 'testing', -fn: function (){ +selector: "shouldBeAliased:", +protocol: 'accessing', +fn: function (aBoolean){ var self=this; -return true; +self["@shouldBeAliased"]=aBoolean; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isMethodScope\x0a\x09^ true", +args: ["aBoolean"], +source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "localReturn", +selector: "shouldBeInlined", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@localReturn"]; +$2=self["@shouldBeInlined"]; if(($receiver = $2) == null || $receiver.isNil){ $1=false; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]", +source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "localReturn:", +selector: "shouldBeInlined:", protocol: 'accessing', fn: function (aBoolean){ var self=this; -self["@localReturn"]=aBoolean; +self["@shouldBeInlined"]=aBoolean; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBoolean"], -source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean", +source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "methodScope", +selector: "size", protocol: 'accessing', fn: function (){ var self=this; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._source())._size(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "methodScope\x0a\x09^ self", +source: "size\x0a\x09^ self source size", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["size", "source"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "nonLocalReturns", +selector: "source", protocol: 'accessing', fn: function (){ var self=this; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@nonLocalReturns"]; +$2=self["@source"]; if(($receiver = $2) == null || $receiver.isNil){ -self["@nonLocalReturns"]=$recv($OrderedCollection())._new(); -$1=self["@nonLocalReturns"]; +$1=""; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "source\x0a\x09^ source ifNil: [ '' ]", +referencedClasses: [], +messageSends: ["ifNil:"] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "pseudoVars", +selector: "source:", protocol: 'accessing', -fn: function (){ +fn: function (aString){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$receiver; -$1=self["@pseudoVars"]; -if(($receiver = $1) == null || $receiver.isNil){ -self["@pseudoVars"]=$recv($Dictionary())._new(); -self["@pseudoVars"]; -$recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv($PseudoVar())._on_(each); -$recv($2)._scope_(self._methodScope()); -$3=$recv($2)._yourself(); -return $recv(self["@pseudoVars"])._at_put_(each,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -} else { -$1; -}; -$4=self["@pseudoVars"]; -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +self["@source"]=aString; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars", -referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"] +args: ["aString"], +source: "source: aString\x0a\x09source := aString", +referencedClasses: [], +messageSends: [] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "removeNonLocalReturn:", -protocol: 'adding', -fn: function (aScope){ +selector: "stopOnStepping", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){ +return false; -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []", +args: [], +source: "stopOnStepping\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["remove:ifAbsent:", "nonLocalReturns"] +messageSends: [] }), -$globals.MethodLexicalScope); +$globals.Node); $core.addMethod( $core.method({ -selector: "unknownVariables", -protocol: 'accessing', +selector: "subtreeNeedsAliasing", +protocol: 'testing', fn: function (){ var self=this; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@unknownVariables"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@unknownVariables"]=$recv($OrderedCollection())._new(); -$1=self["@unknownVariables"]; -} else { -$1=$2; -}; +var $1; +$1=$recv($recv(self._shouldBeAliased())._or_((function(){ +return $core.withContext(function($ctx2) { +return self._shouldBeInlined(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})))._or_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._nodes())._anySatisfy_((function(each){ +return $core.withContext(function($ctx3) { +return $recv(each)._subtreeNeedsAliasing(); +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$ctx1.sendIdx["or:"]=1; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]", +referencedClasses: [], +messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"] }), -$globals.MethodLexicalScope); +$globals.Node); -$core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars."; -//>>excludeEnd("ide"); +$core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST'); +$globals.AssignmentNode.comment="I represent an assignment node."; $core.addMethod( $core.method({ -selector: "alias", -protocol: 'accessing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._name())._asVariableName(); +$1=$recv(aVisitor)._visitAssignmentNode_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "alias\x0a\x09^ self name asVariableName", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["asVariableName", "name"] +messageSends: ["visitAssignmentNode:"] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isArgVar", +selector: "isAssignmentNode", protocol: 'testing', fn: function (){ var self=this; -return false; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isArgVar\x0a\x09^ false", +source: "isAssignmentNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isClassRefVar", -protocol: 'testing', +selector: "left", +protocol: 'accessing', fn: function (){ var self=this; -return false; +var $1; +$1=self["@left"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isClassRefVar\x0a\x09^ false", +source: "left\x0a\x09^ left", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isImmutable", -protocol: 'testing', -fn: function (){ +selector: "left:", +protocol: 'accessing', +fn: function (aNode){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +self["@left"]=aNode; +$recv(aNode)._parent_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isImmutable\x0a\x09^ false", +args: ["aNode"], +source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["parent:"] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isInstanceVar", -protocol: 'testing', +selector: "nodes", +protocol: 'accessing', fn: function (){ var self=this; -return false; - +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($Array())._with_with_(self._left(),self._right()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isInstanceVar\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "nodes\x0a\x09^ Array with: self left with: self right", +referencedClasses: ["Array"], +messageSends: ["with:with:", "left", "right"] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isPseudoVar", -protocol: 'testing', +selector: "right", +protocol: 'accessing', fn: function (){ var self=this; -return false; +var $1; +$1=self["@right"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isPseudoVar\x0a\x09^ false", +source: "right\x0a\x09^ right", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isTempVar", -protocol: 'testing', -fn: function (){ +selector: "right:", +protocol: 'accessing', +fn: function (aNode){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +self["@right"]=aNode; +$recv(aNode)._parent_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isTempVar\x0a\x09^ false", +args: ["aNode"], +source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["parent:"] }), -$globals.ScopeVar); +$globals.AssignmentNode); $core.addMethod( $core.method({ -selector: "isUnknownVar", +selector: "shouldBeAliased", protocol: 'testing', fn: function (){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +var $2,$1; +$2=( +$ctx1.supercall = true, +$globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), [])); +$ctx1.supercall = false; +$1=$recv($2)._or_((function(){ +return $core.withContext(function($ctx2) { +return self._isReferenced(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isUnknownVar\x0a\x09^ false", +source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["or:", "shouldBeAliased", "isReferenced"] }), -$globals.ScopeVar); +$globals.AssignmentNode); + + +$core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST'); +$globals.BlockNode.comment="I represent an block closure node."; $core.addMethod( $core.method({ -selector: "name", -protocol: 'accessing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@name"]; +$1=$recv(aVisitor)._visitBlockNode_(self); return $1; - +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "name\x0a\x09^ name", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitBlockNode:"] }), -$globals.ScopeVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "name:", -protocol: 'accessing', -fn: function (aString){ +selector: "isBlockNode", +protocol: 'testing', +fn: function (){ var self=this; -self["@name"]=aString; -return self; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "name: aString\x0a\x09name := aString", +args: [], +source: "isBlockNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "scope", +selector: "nextChild", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@scope"]; -return $1; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "scope\x0a\x09^ scope", +source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "scope:", +selector: "nextNode:", protocol: 'accessing', -fn: function (aScope){ +fn: function (aNode){ var self=this; -self["@scope"]=aScope; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "scope: aScope\x0a\x09scope := aScope", +args: ["aNode"], +source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ScopeVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "validateAssignment", -protocol: 'testing', +selector: "parameters", +protocol: 'accessing', fn: function (){ var self=this; -function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -$1=$recv(self._isArgVar())._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._isPseudoVar(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($1)){ -$2=$recv($InvalidAssignmentError())._new(); -$recv($2)._variableName_(self._name()); -$3=$recv($2)._signal(); -$3; +var $2,$1,$receiver; +$2=self["@parameters"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@parameters"]=$recv($Array())._new(); +$1=self["@parameters"]; +} else { +$1=$2; }; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]", -referencedClasses: ["InvalidAssignmentError"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"] +source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]", +referencedClasses: ["Array"], +messageSends: ["ifNil:", "new"] }), -$globals.ScopeVar); - +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "on:", -protocol: 'instance creation', -fn: function (aString){ +selector: "parameters:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._name_(aString); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)}); -//>>excludeEnd("ctx"); +self["@parameters"]=aCollection; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself", +args: ["aCollection"], +source: "parameters: aCollection\x0a\x09parameters := aCollection", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["name:", "new", "yourself"] +messageSends: [] }), -$globals.ScopeVar.klass); - +$globals.BlockNode); -$core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AliasVar.comment="I am an internally defined variable by the compiler"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "node", +selector: "scope", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@node"]; +$1=self["@scope"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "node\x0a\x09^ node", +source: "scope\x0a\x09^ scope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AliasVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "node:", +selector: "scope:", protocol: 'accessing', -fn: function (aNode){ +fn: function (aLexicalScope){ var self=this; -self["@node"]=aNode; +self["@scope"]=aLexicalScope; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "node: aNode\x0a\x09node := aNode", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.AliasVar); - - - -$core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ArgVar.comment="I am an argument of a method or block."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "isArgVar", -protocol: 'testing', -fn: function (){ -var self=this; -return true; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isArgVar\x0a\x09^ true", +args: ["aLexicalScope"], +source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ArgVar); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "isImmutable", +selector: "subtreeNeedsAliasing", protocol: 'testing', fn: function (){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._shouldBeAliased())._or_((function(){ +return $core.withContext(function($ctx2) { +return self._shouldBeInlined(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isImmutable\x0a\x09^ true", +source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"] }), -$globals.ArgVar); +$globals.BlockNode); -$core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ClassRefVar.comment="I am an class reference variable"; -//>>excludeEnd("ide"); +$core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST'); +$globals.CascadeNode.comment="I represent an cascade node."; $core.addMethod( $core.method({ -selector: "alias", -protocol: 'accessing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv("$".__comma(self._name())).__comma("()"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); +$1=$recv(aVisitor)._visitCascadeNode_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "name"] +messageSends: ["visitCascadeNode:"] }), -$globals.ClassRefVar); +$globals.CascadeNode); $core.addMethod( $core.method({ -selector: "isClassRefVar", +selector: "isCascadeNode", protocol: 'testing', fn: function (){ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isClassRefVar\x0a\x09^ true", +source: "isCascadeNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ClassRefVar); +$globals.CascadeNode); $core.addMethod( $core.method({ -selector: "isImmutable", -protocol: 'testing', +selector: "receiver", +protocol: 'accessing', fn: function (){ var self=this; -return true; +var $1; +$1=self["@receiver"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isImmutable\x0a\x09^ true", +source: "receiver\x0a\x09^ receiver", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ClassRefVar); - - +$globals.CascadeNode); -$core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.InstanceVar.comment="I am an instance variable of a method or block."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "alias", -protocol: 'testing', -fn: function (){ +selector: "receiver:", +protocol: 'accessing', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)}); -//>>excludeEnd("ctx"); +self["@receiver"]=aNode; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'", +args: ["aNode"], +source: "receiver: aNode\x0a\x09receiver := aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [",", "name"] +messageSends: [] }), -$globals.InstanceVar); +$globals.CascadeNode); + + +$core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST'); +$globals.DynamicArrayNode.comment="I represent an dynamic array node."; $core.addMethod( $core.method({ -selector: "isInstanceVar", -protocol: 'testing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitDynamicArrayNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isInstanceVar\x0a\x09^ true", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitDynamicArrayNode:"] }), -$globals.InstanceVar); +$globals.DynamicArrayNode); -$core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"; -//>>excludeEnd("ide"); +$core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST'); +$globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node."; $core.addMethod( $core.method({ -selector: "alias", -protocol: 'accessing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._name(); +$1=$recv(aVisitor)._visitDynamicDictionaryNode_(self); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "alias\x0a\x09^ self name", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["name"] +messageSends: ["visitDynamicDictionaryNode:"] }), -$globals.PseudoVar); +$globals.DynamicDictionaryNode); + + +$core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST'); +$globals.JSStatementNode.comment="I represent an JavaScript statement node."; $core.addMethod( $core.method({ -selector: "isImmutable", -protocol: 'testing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitJSStatementNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isImmutable\x0a\x09^ true", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitJSStatementNode:"] }), -$globals.PseudoVar); +$globals.JSStatementNode); $core.addMethod( $core.method({ -selector: "isPseudoVar", +selector: "isJSStatementNode", protocol: 'testing', fn: function (){ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isPseudoVar\x0a\x09^ true", +source: "isJSStatementNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.PseudoVar); - - +$globals.JSStatementNode); -$core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TempVar.comment="I am an temporary variable of a method or block."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "isTempVar", +selector: "requiresSmalltalkContext", protocol: 'testing', fn: function (){ var self=this; return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isTempVar\x0a\x09^ true", +source: "requiresSmalltalkContext\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TempVar); +$globals.JSStatementNode); -$core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"; -//>>excludeEnd("ide"); +$core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST'); +$globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST."; $core.addMethod( $core.method({ -selector: "isUnknownVar", -protocol: 'testing', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitMethodNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isUnknownVar\x0a\x09^ true", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitMethodNode:"] }), -$globals.UnknownVar); - - +$globals.MethodNode); -$core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "classReferences", +selector: "arguments", protocol: 'accessing', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@classReferences"]; +$2=self["@arguments"]; if(($receiver = $2) == null || $receiver.isNil){ -self["@classReferences"]=$recv($Set())._new(); -$1=self["@classReferences"]; +$1=[]; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "arguments\x0a\x09^ arguments ifNil: [ #() ]", +referencedClasses: [], +messageSends: ["ifNil:"] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "errorShadowingVariable:", -protocol: 'error handling', -fn: function (aString){ +selector: "arguments:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($ShadowingVariableError())._new(); -$recv($1)._variableName_(aString); -$2=$recv($1)._signal(); +self["@arguments"]=aCollection; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal", -referencedClasses: ["ShadowingVariableError"], -//>>excludeEnd("ide"); -messageSends: ["variableName:", "new", "signal"] +args: ["aCollection"], +source: "arguments: aCollection\x0a\x09arguments := aCollection", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "errorUnknownVariable:", -protocol: 'error handling', -fn: function (aNode){ +selector: "classReferences", +protocol: 'accessing', +fn: function (){ var self=this; -var identifier; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5; -identifier=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._isVariableUndefined_inPackage_(identifier,self._thePackage()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($1)){ -$2=$recv($UnknownVariableError())._new(); -$3=$2; -$4=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=2; -//>>excludeEnd("ctx"); -$recv($3)._variableName_($4); -$5=$recv($2)._signal(); -$5; -} else { -$recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value()); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@classReferences"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]", -referencedClasses: ["Smalltalk", "UnknownVariableError"], -//>>excludeEnd("ide"); -messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"] +args: [], +source: "classReferences\x0a\x09^ classReferences", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "isVariableUndefined:inPackage:", -protocol: 'testing', -fn: function (aString,aPackage){ +selector: "classReferences:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$4,$2,$receiver; -if(($receiver = aPackage) == null || $receiver.isNil){ -aPackage; -} else { -var packageKnownVars; -packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key"); -packageKnownVars; -$1=$recv(packageKnownVars)._includes_(aString); -if($core.assert($1)){ -return false; -}; -}; -$3=$recv($Compiler())._new(); -$4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._eval_($4); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +self["@classReferences"]=aCollection; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aPackage"], -source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'", -referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","] +args: ["aCollection"], +source: "classReferences: aCollection\x0a\x09classReferences := aCollection", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ @@ -48774,22016 +35302,19115 @@ selector: "messageSends", protocol: 'accessing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@messageSends"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@messageSends"]=$recv($Dictionary())._new(); -$1=self["@messageSends"]; -} else { -$1=$2; -}; +var $1; +$1=$recv(self._sendIndexes())._keys(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "messageSends\x0a\x09^ self sendIndexes keys", +referencedClasses: [], +messageSends: ["keys", "sendIndexes"] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "newBlockScope", -protocol: 'factory', +selector: "method", +protocol: 'accessing', fn: function (){ var self=this; -function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._newScopeOfClass_($LexicalScope()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope", -referencedClasses: ["LexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["newScopeOfClass:"] +source: "method\x0a\x09^ self", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "newMethodScope", -protocol: 'factory', +selector: "scope", +protocol: 'accessing', fn: function (){ var self=this; -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._newScopeOfClass_($MethodLexicalScope()); +$1=self["@scope"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope", -referencedClasses: ["MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["newScopeOfClass:"] +source: "scope\x0a\x09^ scope", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "newScopeOfClass:", -protocol: 'factory', -fn: function (aLexicalScopeClass){ +selector: "scope:", +protocol: 'accessing', +fn: function (aMethodScope){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv(aLexicalScopeClass)._new(); -$recv($2)._outerScope_(self["@currentScope"]); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +self["@scope"]=aMethodScope; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aLexicalScopeClass"], -source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself", +args: ["aMethodScope"], +source: "scope: aMethodScope\x0a\x09scope := aMethodScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["outerScope:", "new", "yourself"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "nextBlockIndex", -protocol: 'private', +selector: "selector", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -$1=self["@blockIndex"]; -if(($receiver = $1) == null || $receiver.isNil){ -self["@blockIndex"]=(0); -self["@blockIndex"]; -} else { -$1; -}; -self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1)); -$2=self["@blockIndex"]; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@selector"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex", +source: "selector\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "+"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "popScope", -protocol: 'scope', -fn: function (){ +selector: "selector:", +protocol: 'accessing', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=self["@currentScope"]; -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -self["@currentScope"]=$recv(self["@currentScope"])._outerScope(); -self["@currentScope"]; -}; +self["@selector"]=aString; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); + +}, +args: ["aString"], +source: "selector: aString\x0a\x09selector := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.MethodNode); + +$core.addMethod( +$core.method({ +selector: "sendIndexes", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@sendIndexes"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]", +source: "sendIndexes\x0a\x09^ sendIndexes", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "outerScope"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "pushScope:", -protocol: 'scope', -fn: function (aScope){ +selector: "sendIndexes:", +protocol: 'accessing', +fn: function (aDictionary){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aScope)._outerScope_(self["@currentScope"]); -self["@currentScope"]=aScope; +self["@sendIndexes"]=aDictionary; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aScope"], -source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope", +args: ["aDictionary"], +source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["outerScope:"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "superSends", +selector: "sequenceNode", protocol: 'accessing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@superSends"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@superSends"]=$recv($Dictionary())._new(); -$1=self["@superSends"]; -} else { -$1=$2; +var $1; +var $early={}; +try { +$recv(self._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +$1=$recv(each)._isSequenceNode(); +if($core.assert($1)){ +throw $early=[each]; }; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return nil; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil", +referencedClasses: [], +messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "theClass", +selector: "source", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@theClass"]; +$1=self["@source"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "theClass\x0a\x09^ theClass", +source: "source\x0a\x09^ source", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "theClass:", +selector: "source:", protocol: 'accessing', -fn: function (aClass){ +fn: function (aString){ var self=this; -self["@theClass"]=aClass; +self["@source"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "theClass: aClass\x0a\x09theClass := aClass", +args: ["aString"], +source: "source: aString\x0a\x09source := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "thePackage", +selector: "superSends", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@thePackage"]; +$1=self["@superSends"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "thePackage\x0a\x09^ thePackage", +source: "superSends\x0a\x09^ superSends", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); $core.addMethod( $core.method({ -selector: "thePackage:", +selector: "superSends:", protocol: 'accessing', -fn: function (aPackage){ +fn: function (aCollection){ var self=this; -self["@thePackage"]=aPackage; +self["@superSends"]=aCollection; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "thePackage: aPackage\x0a\x09thePackage := aPackage", +args: ["aCollection"], +source: "superSends: aCollection\x0a\x09superSends := aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.MethodNode); + + +$core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST'); +$globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return."; $core.addMethod( $core.method({ -selector: "validateVariableScope:", -protocol: 'scope', -fn: function (aString){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=$recv(self["@currentScope"])._lookupVariable_(aString); -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -self._errorShadowingVariable_(aString); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(aVisitor)._visitReturnNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"] +messageSends: ["visitReturnNode:"] }), -$globals.SemanticAnalyzer); +$globals.ReturnNode); $core.addMethod( $core.method({ -selector: "visitAssignmentNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isReturnNode", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv($recv(aNode)._left())._beAssigned(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned", +args: [], +source: "isReturnNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitAssignmentNode:", "beAssigned", "left"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.ReturnNode); $core.addMethod( $core.method({ -selector: "visitBlockNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "nonLocalReturn", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._pushScope_(self._newBlockScope()); -$recv(aNode)._scope_(self["@currentScope"]); -$recv(self["@currentScope"])._node_(aNode); -$recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex()); -$recv($recv(aNode)._parameters())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self._validateVariableScope_(each); -return $recv(self["@currentScope"])._addArg_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self._popScope(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($recv(self._scope())._isMethodScope())._not(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope", +args: [], +source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"] +messageSends: ["not", "isMethodScope", "scope"] }), -$globals.SemanticAnalyzer); +$globals.ReturnNode); $core.addMethod( $core.method({ -selector: "visitCascadeNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "scope", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$3=$recv(aNode)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._first(); -$1=$recv($2)._superSend(); -if($core.assert($1)){ -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._superSend_(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@scope"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]", +args: [], +source: "scope\x0a\x09^ scope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.ReturnNode); $core.addMethod( $core.method({ -selector: "visitMethodNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "scope:", +protocol: 'accessing', +fn: function (aLexicalScope){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._pushScope_(self._newMethodScope()); -$recv(aNode)._scope_(self["@currentScope"]); -$recv(self["@currentScope"])._node_(aNode); -$recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@currentScope"])._addIVar_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(aNode)._arguments())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self._validateVariableScope_(each); -return $recv(self["@currentScope"])._addArg_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aNode)._classReferences_(self._classReferences()); -$recv(aNode)._sendIndexes_(self._messageSends()); -$1=$recv(aNode)._superSends_($recv(self._superSends())._keys()); -self._popScope(); +self["@scope"]=aLexicalScope; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope", +args: ["aLexicalScope"], +source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"] +messageSends: [] }), -$globals.SemanticAnalyzer); +$globals.ReturnNode); + + +$core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST'); +$globals.SendNode.comment="I represent an message send node."; $core.addMethod( $core.method({ -selector: "visitReturnNode:", +selector: "accept:", protocol: 'visiting', -fn: function (aNode){ +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$recv(aNode)._scope_(self["@currentScope"]); -$1=$recv(self["@currentScope"])._isMethodScope(); -if($core.assert($1)){ -$recv(self["@currentScope"])._localReturn_(true); -} else { -$recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]); -}; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +$1=$recv(aVisitor)._visitSendNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"] +messageSends: ["visitSendNode:"] }), -$globals.SemanticAnalyzer); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "visitSendNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "arguments", +protocol: 'accessing', +fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver; -$3=$recv(aNode)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._value(); -$1=$recv($2).__eq("super"); -if($core.assert($1)){ -$recv(aNode)._superSend_(true); -$4=$recv(aNode)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=2; -//>>excludeEnd("ctx"); -$recv($4)._value_("self"); -$5=self._superSends(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["superSends"]=1; -//>>excludeEnd("ctx"); -$6=$recv(aNode)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -$recv($5)._at_ifAbsentPut_($6,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Set())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsentPut:"]=1; -//>>excludeEnd("ctx"); -$8=self._superSends(); -$9=$recv(aNode)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=2; -//>>excludeEnd("ctx"); -$7=$recv($8)._at_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); -$recv($7)._add_(aNode); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -} else { -$11=$recv($IRSendInliner())._inlinedSelectors(); -$12=$recv(aNode)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=3; -//>>excludeEnd("ctx"); -$10=$recv($11)._includes_($12); -if($core.assert($10)){ -$recv(aNode)._shouldBeInlined_(true); -$13=$recv(aNode)._receiver(); -if(($receiver = $13) == null || $receiver.isNil){ -$13; +var $2,$1,$receiver; +$2=self["@arguments"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@arguments"]=[]; +$1=self["@arguments"]; } else { -var receiver; -receiver=$receiver; -$recv(receiver)._shouldBeAliased_(true); -}; -}; +$1=$2; }; -$14=self._messageSends(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["messageSends"]=1; -//>>excludeEnd("ctx"); -$15=$recv(aNode)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=4; -//>>excludeEnd("ctx"); -$recv($14)._at_ifAbsentPut_($15,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Set())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); -//>>excludeEnd("ctx"); -})); -$17=self._messageSends(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["messageSends"]=2; -//>>excludeEnd("ctx"); -$18=$recv(aNode)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=5; -//>>excludeEnd("ctx"); -$16=$recv($17)._at_($18); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=2; -//>>excludeEnd("ctx"); -$recv($16)._add_(aNode); -$recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size()); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode", -referencedClasses: ["Set", "IRSendInliner"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"] +args: [], +source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]", +referencedClasses: [], +messageSends: ["ifNil:"] }), -$globals.SemanticAnalyzer); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "visitSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "arguments:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv(aNode)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self["@arguments"]=aCollection; +$recv(aCollection)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self._validateVariableScope_(each); -return $recv(self["@currentScope"])._addTemp_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(each)._parent_(self); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode", +args: ["aCollection"], +source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"] +messageSends: ["do:", "parent:"] }), -$globals.SemanticAnalyzer); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "visitVariableNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "cascadeNodeWithMessages:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -var binding; -function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)} -function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var first; +function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)} +function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)} +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver; -binding=$recv(self["@currentScope"])._lookupVariable_(aNode); -$1=binding; -if(($receiver = $1) == null || $receiver.isNil){ -$3=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._isCapitalized(); -if($core.assert($2)){ -$4=$recv($ClassRefVar())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$4,$5,$3; +$1=$recv($SendNode())._new(); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$5=$4; -$6=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=2; -//>>excludeEnd("ctx"); -$recv($5)._name_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["name:"]=1; -//>>excludeEnd("ctx"); -$7=$recv($4)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv($1)._selector_(self._selector()); +$recv($1)._arguments_(self._arguments()); +$2=$recv($1)._yourself(); $ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -binding=$7; -binding; -$8=self._classReferences(); -$9=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=3; -//>>excludeEnd("ctx"); -$recv($8)._add_($9); -} else { -self._errorUnknownVariable_(aNode); -$10=$recv($UnknownVar())._new(); -$recv($10)._name_($recv(aNode)._value()); -$11=$recv($10)._yourself(); -binding=$11; -binding; -}; -} else { -$1; -}; -$recv(aNode)._binding_(binding); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)}); -//>>excludeEnd("ctx"); +first=$2; +$4=$recv($CascadeNode())._new(); +$recv($4)._receiver_(self._receiver()); +$recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection)); +$5=$recv($4)._yourself(); +$3=$5; +return $3; +}, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.", -referencedClasses: ["ClassRefVar", "UnknownVar"], -//>>excludeEnd("ide"); -messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"] +args: ["aCollection"], +source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself", +referencedClasses: ["SendNode", "CascadeNode", "Array"], +messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"] }), -$globals.SemanticAnalyzer); - +$globals.SendNode); $core.addMethod( $core.method({ -selector: "on:", -protocol: 'instance creation', -fn: function (aClass){ +selector: "index", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._theClass_(aClass); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=self["@index"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["theClass:", "new", "yourself"] -}), -$globals.SemanticAnalyzer.klass); - -}); - -define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Interpreter'); -$core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"}; -$core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`)."; -//>>excludeEnd("ide"); -$core.addMethod( -$core.method({ -selector: "applyTo:arguments:", -protocol: 'evaluating', -fn: function (anObject,aCollection){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._interpreterError(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject", "aCollection"], -source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError", +args: [], +source: "index\x0a\x09^ index", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["interpreterError"] +messageSends: [] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "compiledSource", +selector: "index:", protocol: 'accessing', -fn: function (){ +fn: function (anInteger){ var self=this; -return "[ AST Block closure ]"; +self["@index"]=anInteger; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'", +args: ["anInteger"], +source: "index: anInteger\x0a\x09index := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "currySelf", -protocol: 'converting', +selector: "isCascadeSendNode", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._interpreterError(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._parent())._isCascadeNode(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "currySelf\x0a\x09self interpreterError", +source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["interpreterError"] +messageSends: ["isCascadeNode", "parent"] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "initializeWithContext:node:", -protocol: 'initialization', -fn: function (aContext,aNode){ +selector: "isNavigationNode", +protocol: 'testing', +fn: function (){ var self=this; -self["@node"]=aNode; -self["@outerContext"]=aContext; -return self; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext", "aNode"], -source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext", +args: [], +source: "isNavigationNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "interpreterError", -protocol: 'error handling', +selector: "isSendNode", +protocol: 'testing', fn: function (){ var self=this; -function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter."); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'", -referencedClasses: ["ASTInterpreterError"], -//>>excludeEnd("ide"); -messageSends: ["signal:"] +source: "isSendNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "numArgs", +selector: "navigationLink", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($recv(self["@node"])._temps())._size(); +$1=self._selector(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "numArgs\x0a\x09^ node temps size", +source: "navigationLink\x0a\x09^ self selector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["size", "temps"] +messageSends: ["selector"] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "value", -protocol: 'evaluating', +selector: "nodes", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._valueWithPossibleArguments_([]); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "value\x0a\x09^ self valueWithPossibleArguments: #()", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["valueWithPossibleArguments:"] -}), -$globals.AIBlockClosure); - -$core.addMethod( -$core.method({ -selector: "value:", -protocol: 'evaluating', -fn: function (anArgument){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._valueWithPossibleArguments_([anArgument]); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); +var $1,$3,$2,$5,$6,$4,$receiver; +$1=self._receiver(); +$ctx1.sendIdx["receiver"]=1; +if(($receiver = $1) == null || $receiver.isNil){ +$3=self._arguments(); +$ctx1.sendIdx["arguments"]=1; +$2=$recv($3)._copy(); +return $2; +} else { +$1; +}; +$5=$recv($Array())._with_(self._receiver()); +$recv($5)._addAll_(self._arguments()); +$6=$recv($5)._yourself(); +$4=$6; +return $4; +}, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anArgument"], -source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["valueWithPossibleArguments:"] +args: [], +source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself", +referencedClasses: ["Array"], +messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "value:value:", -protocol: 'evaluating', -fn: function (firstArgument,secondArgument){ +selector: "receiver", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._valueWithPossibleArguments_([firstArgument,secondArgument]); +$1=self["@receiver"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["firstArgument", "secondArgument"], -source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}", +args: [], +source: "receiver\x0a\x09^ receiver", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["valueWithPossibleArguments:"] +messageSends: [] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "value:value:value:", -protocol: 'evaluating', -fn: function (firstArgument,secondArgument,thirdArgument){ +selector: "receiver:", +protocol: 'accessing', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); +self["@receiver"]=aNode; +$1=$recv(aNode)._isNode(); +if($core.assert($1)){ +$recv(aNode)._parent_(self); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["firstArgument", "secondArgument", "thirdArgument"], -source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}", +args: ["aNode"], +source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["valueWithPossibleArguments:"] +messageSends: ["ifTrue:", "isNode", "parent:"] }), -$globals.AIBlockClosure); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "valueWithPossibleArguments:", -protocol: 'evaluating', -fn: function (aCollection){ +selector: "requiresSmalltalkContext", +protocol: 'testing', +fn: function (){ var self=this; -var context,sequenceNode; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6; -context=$recv(self["@outerContext"])._newInnerContext(); -$1=$recv($recv($recv(self["@node"])._nodes())._first())._copy(); -$recv($1)._parent_(nil); -$2=$recv($1)._yourself(); -sequenceNode=$2; -$recv($recv(sequenceNode)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(context)._defineLocal_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["defineLocal:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(context)._defineLocal_(each); -return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){ -return nil; +return true; -}))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$3=$recv(context)._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); -$recv($3)._node_($recv(sequenceNode)._nextChild()); -$4=$recv($3)._proceed(); -$5=$recv(self["@outerContext"])._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=2; -//>>excludeEnd("ctx"); -$recv($5)._setNonLocalReturnFromContext_(context); -$6=$recv($recv(context)._interpreter())._pop(); -return $6; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop", +args: [], +source: "requiresSmalltalkContext\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"] +messageSends: [] }), -$globals.AIBlockClosure); - +$globals.SendNode); $core.addMethod( $core.method({ -selector: "forContext:node:", -protocol: 'instance creation', -fn: function (aContext,aNode){ +selector: "selector", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._initializeWithContext_node_(aContext,aNode); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=self["@selector"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext", "aNode"], -source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself", +args: [], +source: "selector\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initializeWithContext:node:", "new", "yourself"] +messageSends: [] }), -$globals.AIBlockClosure.klass); +$globals.SendNode); +$core.addMethod( +$core.method({ +selector: "selector:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@selector"]=aString; +return self; + +}, +args: ["aString"], +source: "selector: aString\x0a\x09selector := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.SendNode); -$core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "arguments", -protocol: 'interpreting', +selector: "shouldBeAliased", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var sends; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._ast())._arguments())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1; +sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size(); +$2=( +$ctx1.supercall = true, +$globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), [])); +$ctx1.supercall = false; +$1=$recv($2)._or_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._localAt_ifAbsent_(each,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._isReferenced())._and_((function(){ return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._error_("Argument not in context"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv($recv($recv(sends).__gt((1)))._and_((function(){ +return $core.withContext(function($ctx4) { +return $recv(self._index()).__lt(sends); +}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)}); +})))._or_((function(){ +return $core.withContext(function($ctx4) { +return self._superSend(); +}, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)}); +})); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); +$ctx2.sendIdx["and:"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); })); +$ctx1.sendIdx["or:"]=1; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]", +source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"] +messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"] }), -$globals.AIContext); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "ast", -protocol: 'interpreting', +selector: "stopOnStepping", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$5,$receiver; -$1=self._isBlockContext(); -if($core.assert($1)){ -$3=self._outerContext(); -if(($receiver = $3) == null || $receiver.isNil){ -$2=$3; -} else { -var context; -context=$receiver; -$2=$recv(context)._ast(); -}; -return $2; -}; -$4=self["@ast"]; -if(($receiver = $4) == null || $receiver.isNil){ -self._initializeAST(); -} else { -$4; -}; -$5=self["@ast"]; -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast", +source: "stopOnStepping\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"] +messageSends: [] }), -$globals.AIContext); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "basicLocalAt:", -protocol: 'private', -fn: function (aString){ +selector: "superSend", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._locals())._at_(aString); +var $2,$1,$receiver; +$2=self["@superSend"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "basicLocalAt: aString\x0a\x09^ self locals at: aString", +args: [], +source: "superSend\x0a\x09^ superSend ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:", "locals"] +messageSends: ["ifNil:"] }), -$globals.AIContext); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "basicLocalAt:put:", -protocol: 'private', -fn: function (aString,anObject){ +selector: "superSend:", +protocol: 'accessing', +fn: function (aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._locals())._at_put_(aString,anObject); +self["@superSend"]=aBoolean; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject", +args: ["aBoolean"], +source: "superSend: aBoolean\x0a\x09superSend := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "locals"] +messageSends: [] }), -$globals.AIContext); +$globals.SendNode); $core.addMethod( $core.method({ -selector: "basicReceiver", -protocol: 'interpreting', -fn: function (){ +selector: "valueForReceiver:", +protocol: 'accessing', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._localAt_("self"); +var $2,$3,$5,$4,$6,$1,$receiver; +$2=$recv($SendNode())._new(); +$recv($2)._position_(self._position()); +$recv($2)._source_(self._source()); +$3=$2; +$5=self._receiver(); +$ctx1.sendIdx["receiver"]=1; +if(($receiver = $5) == null || $receiver.isNil){ +$4=anObject; +} else { +$4=$recv(self._receiver())._valueForReceiver_(anObject); +}; +$recv($3)._receiver_($4); +$recv($2)._selector_(self._selector()); +$recv($2)._arguments_(self._arguments()); +$6=$recv($2)._yourself(); +$1=$6; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "basicReceiver\x0a\x09^ self localAt: 'self'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["localAt:"] +args: ["anObject"], +source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself", +referencedClasses: ["SendNode"], +messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"] }), -$globals.AIContext); +$globals.SendNode); + + +$core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST'); +$globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope)."; $core.addMethod( $core.method({ -selector: "defineLocal:", -protocol: 'accessing', -fn: function (aString){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._locals())._at_put_(aString,nil); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(aVisitor)._visitSequenceNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "defineLocal: aString\x0a\x09self locals at: aString put: nil", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "locals"] +messageSends: ["visitSequenceNode:"] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "evaluate:on:", -protocol: 'evaluating', -fn: function (aString,anEvaluator){ +selector: "asBlockSequenceNode", +protocol: 'converting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(anEvaluator)._evaluate_context_(aString,self); +var $2,$3,$1; +$2=$recv($BlockSequenceNode())._new(); +$recv($2)._position_(self._position()); +$recv($2)._source_(self._source()); +$recv($2)._nodes_(self._nodes()); +$recv($2)._temps_(self._temps()); +$3=$recv($2)._yourself(); +$1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anEvaluator"], -source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["evaluate:context:"] +args: [], +source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself", +referencedClasses: ["BlockSequenceNode"], +messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "evaluateNode:", -protocol: 'evaluating', -fn: function (aNode){ +selector: "isSequenceNode", +protocol: 'testing', +fn: function (){ var self=this; -function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($ASTInterpreter())._new(); -$recv($2)._context_(self); -$recv($2)._node_($recv(aNode)._nextChild()); -$recv($2)._proceed(); -$3=$recv($2)._result(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result", -referencedClasses: ["ASTInterpreter"], -//>>excludeEnd("ide"); -messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"] +args: [], +source: "isSequenceNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "evaluatedSelector", +selector: "scope", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@evaluatedSelector"]; +$1=self["@scope"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "evaluatedSelector\x0a\x09^ evaluatedSelector", +source: "scope\x0a\x09^ scope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "evaluatedSelector:", +selector: "scope:", protocol: 'accessing', -fn: function (aString){ +fn: function (aLexicalScope){ var self=this; -self["@evaluatedSelector"]=aString; +self["@scope"]=aLexicalScope; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString", +args: ["aLexicalScope"], +source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "index", +selector: "temps", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@index"]; +$2=self["@temps"]; if(($receiver = $2) == null || $receiver.isNil){ -$1=(0); +$1=[]; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "index\x0a\x09^ index ifNil: [ 0 ]", +source: "temps\x0a\x09^ temps ifNil: [ #() ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:"] }), -$globals.AIContext); +$globals.SequenceNode); $core.addMethod( $core.method({ -selector: "index:", +selector: "temps:", protocol: 'accessing', -fn: function (anInteger){ +fn: function (aCollection){ var self=this; -self["@index"]=anInteger; +self["@temps"]=aCollection; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInteger"], -source: "index: anInteger\x0a\x09index := anInteger", +args: ["aCollection"], +source: "temps: aCollection\x0a\x09temps := aCollection", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.SequenceNode); + + +$core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST'); +$globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes."; $core.addMethod( $core.method({ -selector: "initializeAST", -protocol: 'initialization', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["method"]=1; -//>>excludeEnd("ctx"); -self["@ast"]=$recv($1)._ast(); -$recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +$1=$recv(aVisitor)._visitBlockSequenceNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self", +referencedClasses: [], +messageSends: ["visitBlockSequenceNode:"] +}), +$globals.BlockSequenceNode); + +$core.addMethod( +$core.method({ +selector: "isBlockSequenceNode", +protocol: 'testing', +fn: function (){ +var self=this; +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast", -referencedClasses: ["SemanticAnalyzer"], -//>>excludeEnd("ide"); -messageSends: ["ast", "method", "visit:", "on:", "methodClass"] +source: "isBlockSequenceNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.AIContext); +$globals.BlockSequenceNode); + + +$core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST'); +$globals.ValueNode.comment="I represent a value node."; $core.addMethod( $core.method({ -selector: "initializeFromMethodContext:", -protocol: 'initialization', -fn: function (aMethodContext){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$receiver; -self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector()); -self._index_($recv(aMethodContext)._index()); -self._sendIndexes_($recv(aMethodContext)._sendIndexes()); -self._receiver_($recv(aMethodContext)._receiver()); -self._supercall_($recv(aMethodContext)._supercall()); -$1=self._selector_($recv(aMethodContext)._selector()); -$2=$recv(aMethodContext)._outerContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["outerContext"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $2) == null || $receiver.isNil){ -$2; -} else { -var outer; -outer=$receiver; -$3=$recv(outer)._methodContext(); -if(($receiver = $3) == null || $receiver.isNil){ -$3; -} else { -self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext())); -}; -$4=$recv(aMethodContext)._locals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["locals"]=1; -//>>excludeEnd("ctx"); -$recv($4)._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._locals())._at_put_(key,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(aVisitor)._visitValueNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethodContext"], -source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"] +messageSends: ["visitValueNode:"] }), -$globals.AIContext); +$globals.ValueNode); $core.addMethod( $core.method({ -selector: "initializeInterpreter", -protocol: 'initialization', +selector: "isImmutable", +protocol: 'testing', fn: function (){ var self=this; -function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$receiver; -$1=$recv($ASTInterpreter())._new(); -$recv($1)._context_(self); -$2=$recv($1)._yourself(); -self["@interpreter"]=$2; -$3=self._innerContext(); -if(($receiver = $3) == null || $receiver.isNil){ -$3; -} else { -self._setupInterpreter_(self["@interpreter"]); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._value())._isImmutable(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]", -referencedClasses: ["ASTInterpreter"], -//>>excludeEnd("ide"); -messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"] +source: "isImmutable\x0a\x09^ self value isImmutable", +referencedClasses: [], +messageSends: ["isImmutable", "value"] }), -$globals.AIContext); +$globals.ValueNode); $core.addMethod( $core.method({ -selector: "initializeLocals", -protocol: 'initialization', +selector: "isValueNode", +protocol: 'testing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@locals"]=$recv($Dictionary())._new(); -$recv(self["@locals"])._at_put_("thisContext",self); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["new", "at:put:"] +source: "isValueNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.AIContext); +$globals.ValueNode); $core.addMethod( $core.method({ -selector: "innerContext", +selector: "value", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@innerContext"]; +$1=self["@value"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "innerContext\x0a\x09^ innerContext", +source: "value\x0a\x09^ value", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.ValueNode); $core.addMethod( $core.method({ -selector: "innerContext:", +selector: "value:", protocol: 'accessing', -fn: function (anAIContext){ +fn: function (anObject){ var self=this; -self["@innerContext"]=anAIContext; +self["@value"]=anObject; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anAIContext"], -source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext", +args: ["anObject"], +source: "value: anObject\x0a\x09value := anObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.ValueNode); + + +$core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST'); +$globals.VariableNode.comment="I represent an variable node."; $core.addMethod( $core.method({ -selector: "interpreter", -protocol: 'interpreting', -fn: function (){ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -$1=self["@interpreter"]; -if(($receiver = $1) == null || $receiver.isNil){ -self._initializeInterpreter(); -} else { -$1; -}; -$2=self["@interpreter"]; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(aVisitor)._visitVariableNode_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter", +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "initializeInterpreter"] +messageSends: ["visitVariableNode:"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "interpreter:", -protocol: 'interpreting', -fn: function (anInterpreter){ +selector: "alias", +protocol: 'accessing', +fn: function (){ var self=this; -self["@interpreter"]=anInterpreter; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._binding())._alias(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInterpreter"], -source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter", +args: [], +source: "alias\x0a\x09^ self binding alias", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["alias", "binding"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "isTopContext", -protocol: 'testing', +selector: "assigned", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._innerContext())._isNil(); +var $2,$1,$receiver; +$2=self["@assigned"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isTopContext\x0a\x09^ self innerContext isNil", +source: "assigned\x0a\x09^ assigned ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isNil", "innerContext"] +messageSends: ["ifNil:"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "localAt:", +selector: "assigned:", protocol: 'accessing', -fn: function (aString){ +fn: function (aBoolean){ var self=this; -var context; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -context=self._lookupContextForLocal_(aString); -$1=$recv(context)._basicLocalAt_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)}); -//>>excludeEnd("ctx"); +self["@assigned"]=aBoolean; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString", +args: ["aBoolean"], +source: "assigned: aBoolean\x0a\x09assigned := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lookupContextForLocal:", "basicLocalAt:"] +messageSends: [] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "localAt:ifAbsent:", +selector: "beAssigned", protocol: 'accessing', -fn: function (aString,aBlock){ +fn: function (){ var self=this; -var context; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -context=self._lookupContextForLocal_ifNone_(aString,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(aBlock)._value(); -throw $early=[$1]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$2=$recv(context)._basicLocalAt_(aString); -return $2; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)}); -//>>excludeEnd("ctx"); +$recv(self._binding())._validateAssignment(); +self["@assigned"]=true; +return self; +}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aBlock"], -source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString", +args: [], +source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"] +messageSends: ["validateAssignment", "binding"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "localAt:put:", +selector: "binding", protocol: 'accessing', -fn: function (aString,anObject){ +fn: function (){ var self=this; -var context; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -context=self._lookupContextForLocal_(aString); -$recv(context)._basicLocalAt_put_(aString,anObject); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@binding"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject", +args: [], +source: "binding\x0a\x09^ binding", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"] +messageSends: [] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "locals", +selector: "binding:", protocol: 'accessing', -fn: function (){ +fn: function (aScopeVar){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -$1=self["@locals"]; -if(($receiver = $1) == null || $receiver.isNil){ -self._initializeLocals(); -} else { -$1; -}; -$2=self["@locals"]; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +self["@binding"]=aScopeVar; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals", +args: ["aScopeVar"], +source: "binding: aScopeVar\x0a\x09binding := aScopeVar", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "initializeLocals"] +messageSends: [] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "lookupContextForLocal:", -protocol: 'private', -fn: function (aString){ +selector: "isArgument", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._lookupContextForLocal_ifNone_(aString,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._variableNotFound(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +$1=$recv(self._binding())._isArgVar(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]", +args: [], +source: "isArgument\x0a\x09^ self binding isArgVar", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"] +messageSends: ["isArgVar", "binding"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "lookupContextForLocal:ifNone:", -protocol: 'private', -fn: function (aString,aBlock){ +selector: "isImmutable", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){ -return self; - -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._outerContext(); -return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(context)._lookupContextForLocal_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +var $1; +$1=$recv(self._binding())._isImmutable(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aBlock"], -source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]", +args: [], +source: "isImmutable\x0a\x09^ self binding isImmutable", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"] +messageSends: ["isImmutable", "binding"] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "newInnerContext", -protocol: 'factory', +selector: "isNavigationNode", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv(self._class())._new(); -$recv($2)._outerContext_(self); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself", +source: "isNavigationNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["outerContext:", "new", "class", "yourself"] +messageSends: [] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "outerContext", -protocol: 'accessing', +selector: "isVariableNode", +protocol: 'testing', fn: function (){ var self=this; -var $1; -$1=self["@outerContext"]; -return $1; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "outerContext\x0a\x09^ outerContext", +source: "isVariableNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.VariableNode); $core.addMethod( $core.method({ -selector: "outerContext:", +selector: "navigationLink", protocol: 'accessing', -fn: function (anAIContext){ +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -self["@outerContext"]=anAIContext; -$1=self["@outerContext"]; -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -var context; -context=$receiver; -$recv(context)._innerContext_(self); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._value(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anAIContext"], -source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]", +args: [], +source: "navigationLink\x0a\x09^ self value", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "innerContext:"] +messageSends: ["value"] }), -$globals.AIContext); +$globals.VariableNode); + $core.addMethod( $core.method({ -selector: "receiver:", -protocol: 'interpreting', -fn: function (anObject){ +selector: "ast", +protocol: '*Compiler-AST', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._locals())._at_put_("self",anObject); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)}); -//>>excludeEnd("ctx"); +var $1,$2; +$1=self._source(); +$ctx1.sendIdx["source"]=1; +$recv($1)._ifEmpty_((function(){ +return $core.withContext(function($ctx2) { +return self._error_("Method source is empty"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$2=$recv($Smalltalk())._parse_(self._source()); +return $2; +}, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "locals"] +args: [], +source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source", +referencedClasses: ["Smalltalk"], +messageSends: ["ifEmpty:", "source", "error:", "parse:"] }), -$globals.AIContext); +$globals.CompiledMethod); $core.addMethod( $core.method({ -selector: "selector", -protocol: 'accessing', +selector: "isNode", +protocol: '*Compiler-AST', fn: function (){ var self=this; -var $1; -$1=self["@selector"]; -return $1; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "selector\x0a\x09^ selector", +source: "isNode\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.Object); + +}); + +define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-Semantic'); +$core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic'); +$globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope."; $core.addMethod( $core.method({ -selector: "selector:", -protocol: 'accessing', +selector: "addArg:", +protocol: 'adding', fn: function (aString){ var self=this; -self["@selector"]=aString; +function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._args(); +$ctx1.sendIdx["args"]=1; +$recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString)); +$recv($recv(self._args())._at_(aString))._scope_(self); return self; - +}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self", +referencedClasses: ["ArgVar"], +messageSends: ["at:put:", "args", "on:", "scope:", "at:"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "sendIndexAt:", -protocol: 'accessing', +selector: "addTemp:", +protocol: 'adding', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){ -return (0); - -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)}); -//>>excludeEnd("ctx"); +$1=self._temps(); +$ctx1.sendIdx["temps"]=1; +$recv($1)._at_put_(aString,$recv($TempVar())._on_(aString)); +$recv($recv(self._temps())._at_(aString))._scope_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:ifAbsent:", "sendIndexes"] +source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self", +referencedClasses: ["TempVar"], +messageSends: ["at:put:", "temps", "on:", "scope:", "at:"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "sendIndexes", +selector: "alias", protocol: 'accessing', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@sendIndexes"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=$recv($Dictionary())._new(); -} else { -$1=$2; -}; +var $1; +$1="$ctx".__comma($recv(self._scopeLevel())._asString()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +source: "alias\x0a\x09^ '$ctx', self scopeLevel asString", +referencedClasses: [], +messageSends: [",", "asString", "scopeLevel"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "sendIndexes:", +selector: "allVariableNames", protocol: 'accessing', -fn: function (aDictionary){ +fn: function (){ var self=this; -self["@sendIndexes"]=aDictionary; -return self; - +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv(self._args())._keys(); +$ctx1.sendIdx["keys"]=1; +$1=$recv($2).__comma($recv(self._temps())._keys()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aDictionary"], -source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", +args: [], +source: "allVariableNames\x0a\x09^ self args keys, self temps keys", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: [",", "keys", "args", "temps"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "setupInterpreter:", -protocol: 'interpreting', -fn: function (anInterpreter){ +selector: "args", +protocol: 'accessing', +fn: function (){ var self=this; -var currentNode; -function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$8,$7,$6,$receiver; -$1=$recv($ASTPCNodeVisitor())._new(); -$recv($1)._selector_(self._evaluatedSelector()); -$recv($1)._context_(self); -$2=$1; -$3=self._ast(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ast"]=1; -//>>excludeEnd("ctx"); -$recv($2)._visit_($3); -$4=$recv($1)._currentNode(); -currentNode=$4; -$5=$recv(self._ast())._sequenceNode(); -if(($receiver = $5) == null || $receiver.isNil){ -$5; +var $2,$1,$receiver; +$2=self["@args"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@args"]=$recv($Dictionary())._new(); +$1=self["@args"]; } else { -var sequence; -sequence=$receiver; -$recv($recv(sequence)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._defineLocal_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); +$1=$2; }; -$recv(anInterpreter)._node_(currentNode); -$8=self._innerContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["innerContext"]=1; -//>>excludeEnd("ctx"); -$7=$recv($8)._arguments(); -$6=$recv($7)._reversed(); -$recv($6)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $1; +}, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)}); +}, +args: [], +source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] +}), +$globals.LexicalScope); + +$core.addMethod( +$core.method({ +selector: "bindingFor:", +protocol: 'accessing', +fn: function (aStringOrNode){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$4,$5,$1; +$2=self._pseudoVars(); +$3=$recv(aStringOrNode)._value(); +$ctx1.sendIdx["value"]=1; +$1=$recv($2)._at_ifAbsent_($3,(function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(anInterpreter)._push_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["push:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); +$4=self._args(); +$5=$recv(aStringOrNode)._value(); +$ctx2.sendIdx["value"]=2; +return $recv($4)._at_ifAbsent_($5,(function(){ +return $core.withContext(function($ctx3) { +return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){ +return nil; + })); -$recv(anInterpreter)._push_($recv(self._innerContext())._receiver()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +$ctx2.sendIdx["at:ifAbsent:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$ctx1.sendIdx["at:ifAbsent:"]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInterpreter"], -source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)", -referencedClasses: ["ASTPCNodeVisitor"], -//>>excludeEnd("ide"); -messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"] +args: ["aStringOrNode"], +source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]", +referencedClasses: [], +messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "supercall", -protocol: 'interpreting', +selector: "blockIndex", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@supercall"]; +$2=self["@blockIndex"]; if(($receiver = $2) == null || $receiver.isNil){ -$1=false; +$1=(0); } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "supercall\x0a\x09^ supercall ifNil: [ false ]", +source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:"] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "supercall:", -protocol: 'interpreting', -fn: function (aBoolean){ +selector: "blockIndex:", +protocol: 'accessing', +fn: function (anInteger){ var self=this; -self["@supercall"]=aBoolean; +self["@blockIndex"]=anInteger; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "supercall: aBoolean\x0a\x09supercall := aBoolean", +args: ["anInteger"], +source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AIContext); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "variableNotFound", -protocol: 'error handling', +selector: "canInlineNonLocalReturns", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._error_("Variable missing"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["error:"] -}), -$globals.AIContext); - - -$core.addMethod( -$core.method({ -selector: "fromMethodContext:", -protocol: 'instance creation', -fn: function (aMethodContext){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._initializeFromMethodContext_(aMethodContext); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$recv(self._isInlined())._and_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._outerScope())._canInlineNonLocalReturns(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethodContext"], -source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself", +args: [], +source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initializeFromMethodContext:", "new", "yourself"] +messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"] }), -$globals.AIContext.klass); - +$globals.LexicalScope); -$core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "context", +selector: "instruction", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@context"]; +$1=self["@instruction"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "context\x0a\x09^ context", +source: "instruction\x0a\x09^ instruction", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AISemanticAnalyzer); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "context:", +selector: "instruction:", protocol: 'accessing', -fn: function (anAIContext){ +fn: function (anIRInstruction){ var self=this; -self["@context"]=anAIContext; +self["@instruction"]=anIRInstruction; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anAIContext"], -source: "context: anAIContext\x0a\x09context := anAIContext", +args: ["anIRInstruction"], +source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.AISemanticAnalyzer); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "visitVariableNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isBlockScope", +protocol: 'testing', +fn: function (){ var self=this; -function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -var $early={}; -try { -$recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=$recv(self._isMethodScope())._not(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)}); +}, +args: [], +source: "isBlockScope\x0a\x09^ self isMethodScope not", +referencedClasses: [], +messageSends: ["not", "isMethodScope"] +}), +$globals.LexicalScope); + +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $3,$2,$1; +$3=self._instruction(); +$ctx1.sendIdx["instruction"]=1; +$2=$recv($3)._notNil(); +$1=$recv($2)._and_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = true, -//>>excludeEnd("ctx"); -$globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.supercall = false; -//>>excludeEnd("ctx");; -throw $early=[$1]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._instruction())._isInlined(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -$recv(aNode)._binding_($recv($ASTContextVar())._new()); -return self; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new", -referencedClasses: ["ASTContextVar"], -//>>excludeEnd("ide"); -messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"] +args: [], +source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]", +referencedClasses: [], +messageSends: ["and:", "notNil", "instruction", "isInlined"] }), -$globals.AISemanticAnalyzer); - - +$globals.LexicalScope); -$core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ASTContextVar.comment="I am a variable defined in a `context`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "context", -protocol: 'accessing', +selector: "isMethodScope", +protocol: 'testing', fn: function (){ var self=this; -var $1; -$1=self["@context"]; -return $1; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "context\x0a\x09^ context", +source: "isMethodScope\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTContextVar); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "context:", +selector: "lookupVariable:", protocol: 'accessing', -fn: function (anObject){ +fn: function (aNode){ var self=this; -self["@context"]=anObject; -return self; - +var lookup; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$receiver; +lookup=self._bindingFor_(aNode); +$1=lookup; +if(($receiver = $1) == null || $receiver.isNil){ +$2=self._outerScope(); +$ctx1.sendIdx["outerScope"]=1; +if(($receiver = $2) == null || $receiver.isNil){ +lookup=$2; +} else { +lookup=$recv(self._outerScope())._lookupVariable_(aNode); +}; +lookup; +} else { +$1; +}; +$3=lookup; +return $3; +}, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "context: anObject\x0a\x09context := anObject", +args: ["aNode"], +source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"] }), -$globals.ASTContextVar); - - +$globals.LexicalScope); -$core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "atEnd", -protocol: 'testing', +selector: "methodScope", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$receiver; -$1=self._context(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["context"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $1) == null || $receiver.isNil){ -return true; +var $2,$1,$receiver; +$2=self._outerScope(); +$ctx1.sendIdx["outerScope"]=1; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$2; } else { -$1; +$1=$recv(self._outerScope())._methodScope(); }; -$2=$recv($recv(self._interpreter())._atEnd())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._context())._isTopContext(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]", +source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"] +messageSends: ["ifNotNil:", "outerScope", "methodScope"] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "context", +selector: "node", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@context"]; +$1=self["@node"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "context\x0a\x09^ context", +source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "context:", +selector: "node:", protocol: 'accessing', -fn: function (aContext){ +fn: function (aNode){ var self=this; -self["@context"]=aContext; +self["@node"]=aNode; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext"], -source: "context: aContext\x0a\x09context := aContext", +args: ["aNode"], +source: "node: aNode\x0a\x09node := aNode", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "flushInnerContexts", -protocol: 'actions', +selector: "outerScope", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=self._context(); -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -var cxt; -cxt=$receiver; -$recv(cxt)._innerContext_(nil); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@outerScope"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]", +source: "outerScope\x0a\x09^ outerScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "context", "innerContext:"] +messageSends: [] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "interpreter", +selector: "outerScope:", +protocol: 'accessing', +fn: function (aLexicalScope){ +var self=this; +self["@outerScope"]=aLexicalScope; +return self; + +}, +args: ["aLexicalScope"], +source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope", +referencedClasses: [], +messageSends: [] +}), +$globals.LexicalScope); + +$core.addMethod( +$core.method({ +selector: "pseudoVars", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self._context(); -if(($receiver = $2) == null || $receiver.isNil){ -$1=$2; -} else { -var ctx; -ctx=$receiver; -$1=$recv(ctx)._interpreter(); -}; +var $1; +$1=$recv(self._methodScope())._pseudoVars(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]", +source: "pseudoVars\x0a\x09^ self methodScope pseudoVars", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "context", "interpreter"] +messageSends: ["pseudoVars", "methodScope"] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "method", +selector: "scopeLevel", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._context())._method(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +var $1,$2,$4,$3,$5,$receiver; +$1=self._outerScope(); +$ctx1.sendIdx["outerScope"]=1; +if(($receiver = $1) == null || $receiver.isNil){ +return (1); +} else { +$1; +}; +$2=self._isInlined(); +if($core.assert($2)){ +$4=self._outerScope(); +$ctx1.sendIdx["outerScope"]=2; +$3=$recv($4)._scopeLevel(); +$ctx1.sendIdx["scopeLevel"]=1; +return $3; +}; +$5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1)); +return $5; +}, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "method\x0a\x09^ self context method", +source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["method", "context"] +messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"] }), -$globals.ASTDebugger); +$globals.LexicalScope); $core.addMethod( $core.method({ -selector: "node", +selector: "temps", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); +$2=self["@temps"]; if(($receiver = $2) == null || $receiver.isNil){ -$1=$2; +self["@temps"]=$recv($Dictionary())._new(); +$1=self["@temps"]; } else { -$1=$recv(self._interpreter())._node(); +$1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "interpreter", "node"] +source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTDebugger); +$globals.LexicalScope); + + +$core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic'); +$globals.MethodLexicalScope.comment="I represent a method scope."; $core.addMethod( $core.method({ -selector: "onStep", -protocol: 'private', -fn: function (){ +selector: "addIVar:", +protocol: 'adding', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$6,$5,$receiver; -$1=self._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); -self["@result"]=$recv($1)._result(); -$3=self._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=2; -//>>excludeEnd("ctx"); -$2=$recv($3)._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["atEnd"]=1; -//>>excludeEnd("ctx"); -if($core.assert($2)){ -$4=$recv(self._context())._outerContext(); -if(($receiver = $4) == null || $receiver.isNil){ -$4; -} else { -var outerContext; -outerContext=$receiver; -self._context_(outerContext); -}; -$6=self._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=3; -//>>excludeEnd("ctx"); -$5=$recv($6)._atEnd(); -if(!$core.assert($5)){ -$recv(self._interpreter())._skip(); -}; -}; -self._flushInnerContexts(); +var $1; +$1=self._iVars(); +$ctx1.sendIdx["iVars"]=1; +$recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString)); +$recv($recv(self._iVars())._at_(aString))._scope_(self); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"] +args: ["aString"], +source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self", +referencedClasses: ["InstanceVar"], +messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"] }), -$globals.ASTDebugger); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "proceed", -protocol: 'stepping', -fn: function (){ +selector: "addNonLocalReturn:", +protocol: 'adding', +fn: function (aScope){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._stepOver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +$recv(self._nonLocalReturns())._add_(aScope); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]", +args: ["aScope"], +source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["whileFalse:", "atEnd", "stepOver"] +messageSends: ["add:", "nonLocalReturns"] }), -$globals.ASTDebugger); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "restart", -protocol: 'stepping', +selector: "allVariableNames", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._interpreter())._restart(); -self._flushInnerContexts(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +var $2,$1; +$2=( +$ctx1.supercall = true, +$globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), [])); +$ctx1.supercall = false; +$1=$recv($2).__comma($recv(self._iVars())._keys()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts", +source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["restart", "interpreter", "flushInnerContexts"] +messageSends: [",", "allVariableNames", "keys", "iVars"] }), -$globals.ASTDebugger); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "result", +selector: "bindingFor:", protocol: 'accessing', -fn: function (){ +fn: function (aNode){ var self=this; -var $1; -$1=self["@result"]; -return $1; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=( +$ctx1.supercall = true, +$globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){ +return nil; +})); +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "result\x0a\x09^ result", +args: ["aNode"], +source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"] }), -$globals.ASTDebugger); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "stepInto", -protocol: 'stepping', +selector: "canInlineNonLocalReturns", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._shouldBeImplemented(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "stepInto\x0a\x09self shouldBeImplemented", +source: "canInlineNonLocalReturns\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["shouldBeImplemented"] +messageSends: [] }), -$globals.ASTDebugger); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "stepOver", -protocol: 'stepping', +selector: "hasLocalReturn", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv(self._context())._isTopContext(); -if($core.assert($1)){ -$recv(self._interpreter())._stepOver(); -} else { -$2=self._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); -$recv($2)._skip(); -}; -self._onStep(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._localReturn(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep", +source: "hasLocalReturn\x0a\x09^ self localReturn", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"] +messageSends: ["localReturn"] }), -$globals.ASTDebugger); - +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "context:", -protocol: 'instance creation', -fn: function (aContext){ +selector: "hasNonLocalReturn", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._context_(aContext); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$recv(self._nonLocalReturns())._notEmpty(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext"], -source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself", +args: [], +source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["context:", "new", "yourself"] +messageSends: ["notEmpty", "nonLocalReturns"] }), -$globals.ASTDebugger.klass); - +$globals.MethodLexicalScope); -$core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "assign:to:", -protocol: 'private', -fn: function (aNode,anObject){ +selector: "iVars", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4; -$1=$recv($recv(aNode)._binding())._isInstanceVar(); -if($core.assert($1)){ -$3=self._context(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["context"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._receiver(); -$4=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$recv($2)._instVarAt_put_($4,anObject); +var $2,$1,$receiver; +$2=self["@iVars"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@iVars"]=$recv($Dictionary())._new(); +$1=self["@iVars"]; } else { -$recv(self._context())._localAt_put_($recv(aNode)._value(),anObject); +$1=$2; }; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode", "anObject"], -source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"] +args: [], +source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "atEnd", +selector: "isMethodScope", protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self["@forceAtEnd"]; -if($core.assert($1)){ return true; -}; -$2=$recv(self._hasReturned())._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._node())._isNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]", +source: "isMethodScope\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "context", +selector: "localReturn", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@context"]; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@localReturn"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "context\x0a\x09^ context", +source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNil:"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "context:", +selector: "localReturn:", protocol: 'accessing', -fn: function (aContext){ +fn: function (aBoolean){ var self=this; -self["@context"]=aContext; +self["@localReturn"]=aBoolean; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext"], -source: "context: aContext\x0a\x09context := aContext", +args: ["aBoolean"], +source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "eval:", -protocol: 'private', -fn: function (aString){ +selector: "methodScope", +protocol: 'accessing', +fn: function (){ var self=this; -var source,function_; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$4,$5; -source=$recv($String())._streamContents_((function(str){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(str)._nextPutAll_("0,(function("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$3=self._context(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["context"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._locals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["locals"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._keys(); -$recv($1)._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(str)._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(str)._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -$recv(str)._nextPutAll_("){ return (function() {"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(str)._nextPutAll_(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$4=$recv(str)._nextPutAll_("})()})"); -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -function_=$recv($recv($Compiler())._new())._eval_(source); -$5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values()); -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values", -referencedClasses: ["String", "Compiler"], -//>>excludeEnd("ide"); -messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"] +args: [], +source: "methodScope\x0a\x09^ self", +referencedClasses: [], +messageSends: [] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "hasReturned", -protocol: 'testing', +selector: "nonLocalReturns", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@returned"]; +$2=self["@nonLocalReturns"]; if(($receiver = $2) == null || $receiver.isNil){ -$1=false; +self["@nonLocalReturns"]=$recv($OrderedCollection())._new(); +$1=self["@nonLocalReturns"]; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "hasReturned\x0a\x09^ returned ifNil: [ false ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] +source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]", +referencedClasses: ["OrderedCollection"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', +selector: "pseudoVars", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@forceAtEnd"]=false; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $1,$2,$3,$4,$receiver; +$1=self["@pseudoVars"]; +if(($receiver = $1) == null || $receiver.isNil){ +self["@pseudoVars"]=$recv($Dictionary())._new(); +self["@pseudoVars"]; +$recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){ +return $core.withContext(function($ctx2) { +$2=$recv($PseudoVar())._on_(each); +$recv($2)._scope_(self._methodScope()); +$3=$recv($2)._yourself(); +return $recv(self["@pseudoVars"])._at_put_(each,$3); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +} else { +$1; +}; +$4=self["@pseudoVars"]; +return $4; +}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["initialize"] +source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars", +referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"], +messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "interpret", -protocol: 'interpreting', -fn: function (){ +selector: "removeNonLocalReturn:", +protocol: 'adding', +fn: function (aScope){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._visit_(self._node()); +$recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){ + +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node", +args: ["aScope"], +source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visit:", "node"] +messageSends: ["remove:ifAbsent:", "nonLocalReturns"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); $core.addMethod( $core.method({ -selector: "interpret:", -protocol: 'interpreting', -fn: function (aNode){ +selector: "unknownVariables", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._node_(aNode); -self._interpret(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self["@unknownVariables"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@unknownVariables"]=$recv($OrderedCollection())._new(); +$1=self["@unknownVariables"]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["node:", "interpret"] +args: [], +source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]", +referencedClasses: ["OrderedCollection"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTInterpreter); +$globals.MethodLexicalScope); + + +$core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic'); +$globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars."; $core.addMethod( $core.method({ -selector: "messageFromSendNode:arguments:", -protocol: 'private', -fn: function (aSendNode,aCollection){ +selector: "alias", +protocol: 'accessing', +fn: function (){ var self=this; -function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Message())._new(); -$recv($2)._selector_($recv(aSendNode)._selector()); -$recv($2)._arguments_(aCollection); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$recv(self._name())._asVariableName(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aSendNode", "aCollection"], -source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself", -referencedClasses: ["Message"], -//>>excludeEnd("ide"); -messageSends: ["selector:", "new", "selector", "arguments:", "yourself"] +args: [], +source: "alias\x0a\x09^ self name asVariableName", +referencedClasses: [], +messageSends: ["asVariableName", "name"] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "messageNotUnderstood:receiver:", -protocol: 'private', -fn: function (aMessage,anObject){ +selector: "isArgVar", +protocol: 'testing', +fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($MessageNotUnderstood())._new(); -$recv($1)._meesage_(aMessage); -$recv($1)._receiver_(anObject); -$2=$recv($1)._signal(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMessage", "anObject"], -source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["meesage:", "new", "receiver:", "signal"] +args: [], +source: "isArgVar\x0a\x09^ false", +referencedClasses: [], +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "next", -protocol: 'interpreting', +selector: "isClassRefVar", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._node_($recv(self._node())._nextNode()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "next\x0a\x09self node: self node nextNode", +source: "isClassRefVar\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["node:", "nextNode", "node"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "node", -protocol: 'accessing', +selector: "isImmutable", +protocol: 'testing', fn: function (){ var self=this; -var $1; -$1=self["@node"]; -return $1; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node", +source: "isImmutable\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "node:", -protocol: 'accessing', -fn: function (aNode){ +selector: "isInstanceVar", +protocol: 'testing', +fn: function (){ var self=this; -self["@node"]=aNode; -return self; +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "node: aNode\x0a\x09node := aNode", +args: [], +source: "isInstanceVar\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "peek", -protocol: 'stack', +selector: "isPseudoVar", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -var $early={}; -try { -$1=self._stack(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["stack"]=1; -//>>excludeEnd("ctx"); -$recv($1)._ifEmpty_((function(){ -throw $early=[nil]; +return false; -})); -$2=$recv(self._stack())._last(); -return $2; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last", +source: "isPseudoVar\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifEmpty:", "stack", "last"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "pop", -protocol: 'stack', +selector: "isTempVar", +protocol: 'testing', fn: function (){ var self=this; -var peekedValue; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -peekedValue=self._peek(); -$recv(self._stack())._removeLast(); -$1=peekedValue; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue", +source: "isTempVar\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["peek", "removeLast", "stack"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "proceed", -protocol: 'interpreting', +selector: "isUnknownVar", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._step(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return false; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]", +source: "isUnknownVar\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["whileFalse:", "atEnd", "step"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "push:", -protocol: 'stack', -fn: function (anObject){ +selector: "name", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._stack())._add_(anObject); +$1=self["@name"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "stack"] -}), -$globals.ASTInterpreter); -$core.addMethod( -$core.method({ -selector: "restart", -protocol: 'interpreting', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._node_($recv($recv(self._context())._ast())._nextChild()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "restart\x0a\x09self node: self context ast nextChild", +source: "name\x0a\x09^ name", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["node:", "nextChild", "ast", "context"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "result", +selector: "name:", protocol: 'accessing', -fn: function (){ +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._hasReturned(); -if($core.assert($2)){ -$1=self._returnValue(); -} else { -$1=$recv(self._context())._receiver(); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +self["@name"]=aString; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]", +args: ["aString"], +source: "name: aString\x0a\x09name := aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "returnValue", +selector: "scope", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@returnValue"]; +$1=self["@scope"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "returnValue\x0a\x09^ returnValue", +source: "scope\x0a\x09^ scope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "returnValue:", +selector: "scope:", protocol: 'accessing', -fn: function (anObject){ +fn: function (aScope){ var self=this; -self["@returnValue"]=anObject; +self["@scope"]=aScope; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "returnValue: anObject\x0a\x09returnValue := anObject", +args: ["aScope"], +source: "scope: aScope\x0a\x09scope := aScope", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.ScopeVar); $core.addMethod( $core.method({ -selector: "sendMessage:to:superSend:", -protocol: 'private', -fn: function (aMessage,anObject,aBoolean){ +selector: "validateAssignment", +protocol: 'testing', +fn: function (){ var self=this; -var method; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$5,$6,$receiver; -var $early={}; -try { -if(!$core.assert(aBoolean)){ -$1=$recv(aMessage)._sendTo_(anObject); -return $1; -}; -$3=$recv(anObject)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $2) == null || $receiver.isNil){ -$4=self._messageNotUnderstood_receiver_(aMessage,anObject); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1; -//>>excludeEnd("ctx"); -return $4; -} else { -$2; -}; -method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3; +$1=$recv(self._isArgVar())._or_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$5=self._messageNotUnderstood_receiver_(aMessage,anObject); -throw $early=[$5]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); +return self._isPseudoVar(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); })); -$6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments()); -return $6; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +if($core.assert($1)){ +$2=$recv($InvalidAssignmentError())._new(); +$recv($2)._variableName_(self._name()); +$3=$recv($2)._signal(); +$3; +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMessage", "anObject", "aBoolean"], -source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"] +args: [], +source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]", +referencedClasses: ["InvalidAssignmentError"], +messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"] }), -$globals.ASTInterpreter); +$globals.ScopeVar); + $core.addMethod( $core.method({ -selector: "setNonLocalReturnFromContext:", -protocol: 'interpreting', -fn: function (aContext){ +selector: "on:", +protocol: 'instance creation', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv(aContext)._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._hasReturned(); -if($core.assert($1)){ -self["@returned"]=true; -self["@returned"]; -self._returnValue_($recv($recv(aContext)._interpreter())._returnValue()); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=self._new(); +$recv($2)._name_(aString); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext"], -source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]", +args: ["aString"], +source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"] +messageSends: ["name:", "new", "yourself"] }), -$globals.ASTInterpreter); +$globals.ScopeVar.klass); + +$core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic'); +$globals.AliasVar.comment="I am an internally defined variable by the compiler"; $core.addMethod( $core.method({ -selector: "skip", -protocol: 'interpreting', +selector: "node", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._next(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@node"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "skip\x0a\x09self next", +source: "node\x0a\x09^ node", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["next"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.AliasVar); $core.addMethod( $core.method({ -selector: "stack", +selector: "node:", protocol: 'accessing', -fn: function (){ +fn: function (aNode){ var self=this; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@stack"]; -if(($receiver = $2) == null || $receiver.isNil){ -self["@stack"]=$recv($OrderedCollection())._new(); -$1=self["@stack"]; -} else { -$1=$2; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +self["@node"]=aNode; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "new"] +args: ["aNode"], +source: "node: aNode\x0a\x09node := aNode", +referencedClasses: [], +messageSends: [] }), -$globals.ASTInterpreter); +$globals.AliasVar); + + +$core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.ArgVar.comment="I am an argument of a method or block."; $core.addMethod( $core.method({ -selector: "step", -protocol: 'interpreting', +selector: "isArgVar", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._interpret(); -$1=self._next(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next", +source: "isArgVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["interpret", "next"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ArgVar); $core.addMethod( $core.method({ -selector: "stepOver", -protocol: 'interpreting', +selector: "isImmutable", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -self._step(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["step"]=1; -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._node(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["node"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isNil(); -return $recv($1)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(self._node())._isSteppingNode(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._step(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]", +source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ArgVar); + + +$core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.ClassRefVar.comment="I am an class reference variable"; $core.addMethod( $core.method({ -selector: "visit:", -protocol: 'visiting', -fn: function (aNode){ +selector: "alias", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._hasReturned(); -if(!$core.assert($1)){ -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +$1=$recv("$".__comma(self._name())).__comma("()"); +$ctx1.sendIdx[","]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]", +args: [], +source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "hasReturned", "visit:"] +messageSends: [",", "name"] }), -$globals.ASTInterpreter); +$globals.ClassRefVar); $core.addMethod( $core.method({ -selector: "visitAssignmentNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isClassRefVar", +protocol: 'testing', +fn: function (){ var self=this; -var poppedValue; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -poppedValue=self._pop(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["pop"]=1; -//>>excludeEnd("ctx"); -self._pop(); -self._push_(poppedValue); -self._assign_to_($recv(aNode)._left(),poppedValue); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue", +args: [], +source: "isClassRefVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["pop", "push:", "assign:to:", "left"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ClassRefVar); $core.addMethod( $core.method({ -selector: "visitBlockNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isImmutable", +protocol: 'testing', +fn: function (){ var self=this; -var block; -function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode); -self._push_(block); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block", -referencedClasses: ["AIBlockClosure"], -//>>excludeEnd("ide"); -messageSends: ["forContext:node:", "context", "push:"] +args: [], +source: "isImmutable\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.ASTInterpreter); +$globals.ClassRefVar); + + +$core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.InstanceVar.comment="I am an instance variable of a method or block."; $core.addMethod( $core.method({ -selector: "visitBlockSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "alias", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@forceAtEnd"]=true; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]"); +$ctx1.sendIdx[","]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true", +args: [], +source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["visitBlockSequenceNode:"] +messageSends: [",", "name"] }), -$globals.ASTInterpreter); +$globals.InstanceVar); $core.addMethod( $core.method({ -selector: "visitDynamicArrayNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isInstanceVar", +protocol: 'testing', +fn: function (){ var self=this; -var array; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=[]; -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(array)._addFirst_(self._pop()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._push_(array); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array", +args: [], +source: "isInstanceVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.InstanceVar); + + +$core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"; $core.addMethod( $core.method({ -selector: "visitDynamicDictionaryNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "alias", +protocol: 'accessing', +fn: function (){ var self=this; -var keyValueList; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -keyValueList=$recv($OrderedCollection())._new(); -$recv($recv(aNode)._nodes())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(keyValueList)._add_(self._pop()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed())); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._name(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)", -referencedClasses: ["OrderedCollection", "HashedCollection"], -//>>excludeEnd("ide"); -messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"] +args: [], +source: "alias\x0a\x09^ self name", +referencedClasses: [], +messageSends: ["name"] }), -$globals.ASTInterpreter); +$globals.PseudoVar); $core.addMethod( $core.method({ -selector: "visitJSStatementNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isImmutable", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@returned"]=true; -self._returnValue_(self._eval_($recv(aNode)._source())); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)", +args: [], +source: "isImmutable\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["returnValue:", "eval:", "source"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.PseudoVar); $core.addMethod( $core.method({ -selector: "visitNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isPseudoVar", +protocol: 'testing', +fn: function (){ var self=this; -return self; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22", +args: [], +source: "isPseudoVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTInterpreter); +$globals.PseudoVar); + + +$core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.TempVar.comment="I am an temporary variable of a method or block."; $core.addMethod( $core.method({ -selector: "visitReturnNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isTempVar", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@returned"]=true; -self._returnValue_(self._pop()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop", +args: [], +source: "isTempVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["returnValue:", "pop"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.TempVar); + + +$core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic'); +$globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"; $core.addMethod( $core.method({ -selector: "visitSendNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "isUnknownVar", +protocol: 'testing', +fn: function (){ var self=this; -var receiver,args,message,result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -args=$recv($recv(aNode)._arguments())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._pop(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["pop"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -receiver=self._pop(); -message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed()); -result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend()); -$1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(aNode)._isLastChild())._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($1)){ -self._push_(receiver); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["push:"]=1; -//>>excludeEnd("ctx"); -} else { -self._push_(result); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]", +args: [], +source: "isUnknownVar\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"] +messageSends: [] }), -$globals.ASTInterpreter); +$globals.UnknownVar); + + +$core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic'); +$globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."; $core.addMethod( $core.method({ -selector: "visitSequenceNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "classReferences", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv(aNode)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._context())._defineLocal_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self["@classReferences"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@classReferences"]=$recv($Set())._new(); +$1=self["@classReferences"]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "temps", "defineLocal:", "context"] +args: [], +source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]", +referencedClasses: ["Set"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTInterpreter); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "visitValueNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "errorShadowingVariable:", +protocol: 'error handling', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._push_($recv(aNode)._value()); +var $1,$2; +$1=$recv($ShadowingVariableError())._new(); +$recv($1)._variableName_(aString); +$2=$recv($1)._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitValueNode: aNode\x0a\x09self push: aNode value", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["push:", "value"] +args: ["aString"], +source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal", +referencedClasses: ["ShadowingVariableError"], +messageSends: ["variableName:", "new", "signal"] }), -$globals.ASTInterpreter); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "visitVariableNode:", -protocol: 'visiting', +selector: "errorUnknownVariable:", +protocol: 'error handling', fn: function (aNode){ var self=this; -function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)} +var identifier; function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7; -$2=$recv(aNode)._binding(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["binding"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isUnknownVar(); -if($core.assert($1)){ -$5=$recv($PlatformInterface())._globals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["globals"]=1; -//>>excludeEnd("ctx"); -$6=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3,$4,$5; +identifier=$recv(aNode)._value(); $ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._at_ifAbsent_($6,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._error_("Unknown variable"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); +return self._isVariableUndefined_inPackage_(identifier,self._thePackage()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -$3=self._push_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["push:"]=1; -//>>excludeEnd("ctx"); -return $3; -}; -$8=$recv($recv(aNode)._binding())._isInstanceVar(); -if($core.assert($8)){ -$10=self._context(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["context"]=1; -//>>excludeEnd("ctx"); -$9=$recv($10)._receiver(); -$11=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +if($core.assert($1)){ +$2=$recv($UnknownVariableError())._new(); +$3=$2; +$4=$recv(aNode)._value(); $ctx1.sendIdx["value"]=2; -//>>excludeEnd("ctx"); -$7=$recv($9)._instVarAt_($11); +$recv($3)._variableName_($4); +$5=$recv($2)._signal(); +$5; } else { -$12=self._context(); -$13=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=3; -//>>excludeEnd("ctx"); -$7=$recv($12)._localAt_ifAbsent_($13,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$15=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["value"]=4; -//>>excludeEnd("ctx"); -$14=$recv($15)._isCapitalized(); -if($core.assert($14)){ -$16=$recv($Smalltalk())._globals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["globals"]=2; -//>>excludeEnd("ctx"); -$17=$recv(aNode)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["value"]=5; -//>>excludeEnd("ctx"); -return $recv($16)._at_ifAbsent_($17,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv($PlatformInterface())._globals())._at_($recv(aNode)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)}); -//>>excludeEnd("ctx"); -})); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); -})); +$recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value()); }; -self._push_($7); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], -source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])", -referencedClasses: ["PlatformInterface", "Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"] +source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]", +referencedClasses: ["Smalltalk", "UnknownVariableError"], +messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"] }), -$globals.ASTInterpreter); - - - -$core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node."; -//>>excludeEnd("ide"); +$globals.SemanticAnalyzer); +$core.addMethod( +$core.method({ +selector: "isVariableUndefined:inPackage:", +protocol: 'testing', +fn: function (aString,aPackage){ +var self=this; +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} +return $core.withContext(function($ctx1) { +var $1,$3,$4,$2,$receiver; +if(($receiver = aPackage) == null || $receiver.isNil){ +aPackage; +} else { +var packageKnownVars; +packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key"); +packageKnownVars; +$1=$recv(packageKnownVars)._includes_(aString); +if($core.assert($1)){ +return false; +}; +}; +$3=$recv($Compiler())._new(); +$4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22"); +$ctx1.sendIdx[","]=1; +$2=$recv($3)._eval_($4); +return $2; +}, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)}); +}, +args: ["aString", "aPackage"], +source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'", +referencedClasses: ["Compiler"], +messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","] +}), +$globals.SemanticAnalyzer); -$core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "context", +selector: "messageSends", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@context"]; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@messageSends"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@messageSends"]=$recv($Dictionary())._new(); +$1=self["@messageSends"]; +} else { +$1=$2; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "context\x0a\x09^ context", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "context:", -protocol: 'accessing', -fn: function (aContext){ +selector: "newBlockScope", +protocol: 'factory', +fn: function (){ var self=this; -self["@context"]=aContext; -return self; - +function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._newScopeOfClass_($LexicalScope()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aContext"], -source: "context: aContext\x0a\x09context := aContext", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: [], +source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope", +referencedClasses: ["LexicalScope"], +messageSends: ["newScopeOfClass:"] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "currentNode", -protocol: 'accessing', +selector: "newMethodScope", +protocol: 'factory', fn: function (){ var self=this; +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} +return $core.withContext(function($ctx1) { var $1; -$1=self["@currentNode"]; +$1=self._newScopeOfClass_($MethodLexicalScope()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)}); +}, +args: [], +source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope", +referencedClasses: ["MethodLexicalScope"], +messageSends: ["newScopeOfClass:"] +}), +$globals.SemanticAnalyzer); + +$core.addMethod( +$core.method({ +selector: "newScopeOfClass:", +protocol: 'factory', +fn: function (aLexicalScopeClass){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv(aLexicalScopeClass)._new(); +$recv($2)._outerScope_(self["@currentScope"]); +$3=$recv($2)._yourself(); +$1=$3; return $1; +}, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)}); +}, +args: ["aLexicalScopeClass"], +source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself", +referencedClasses: [], +messageSends: ["outerScope:", "new", "yourself"] +}), +$globals.SemanticAnalyzer); +$core.addMethod( +$core.method({ +selector: "nextBlockIndex", +protocol: 'private', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$receiver; +$1=self["@blockIndex"]; +if(($receiver = $1) == null || $receiver.isNil){ +self["@blockIndex"]=(0); +self["@blockIndex"]; +} else { +$1; +}; +self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1)); +$2=self["@blockIndex"]; +return $2; +}, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "currentNode\x0a\x09^ currentNode", +source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifNil:", "+"] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "increaseIndex", -protocol: 'accessing', +selector: "popScope", +protocol: 'scope', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@index"]=$recv(self._index()).__plus((1)); +var $1,$receiver; +$1=self["@currentScope"]; +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +self["@currentScope"]=$recv(self["@currentScope"])._outerScope(); +self["@currentScope"]; +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "increaseIndex\x0a\x09index := self index + 1", +source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["+", "index"] +messageSends: ["ifNotNil:", "outerScope"] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "index", +selector: "pushScope:", +protocol: 'scope', +fn: function (aScope){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aScope)._outerScope_(self["@currentScope"]); +self["@currentScope"]=aScope; +return self; +}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)}); +}, +args: ["aScope"], +source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope", +referencedClasses: [], +messageSends: ["outerScope:"] +}), +$globals.SemanticAnalyzer); + +$core.addMethod( +$core.method({ +selector: "superSends", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; -$2=self["@index"]; +$2=self["@superSends"]; if(($receiver = $2) == null || $receiver.isNil){ -self["@index"]=(0); -$1=self["@index"]; +self["@superSends"]=$recv($Dictionary())._new(); +$1=self["@superSends"]; } else { $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "index\x0a\x09^ index ifNil: [ index := 0 ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:"] +source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "selector", +selector: "theClass", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@selector"]; +$1=self["@theClass"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "selector\x0a\x09^ selector", +source: "theClass\x0a\x09^ theClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "selector:", +selector: "theClass:", protocol: 'accessing', -fn: function (aString){ +fn: function (aClass){ var self=this; -self["@selector"]=aString; +self["@theClass"]=aClass; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "selector: aString\x0a\x09selector := aString", +args: ["aClass"], +source: "theClass: aClass\x0a\x09theClass := aClass", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "visitJSStatementNode:", -protocol: 'visiting', -fn: function (aNode){ +selector: "thePackage", +protocol: 'accessing', +fn: function (){ var self=this; -self["@currentNode"]=aNode; +var $1; +$1=self["@thePackage"]; +return $1; + +}, +args: [], +source: "thePackage\x0a\x09^ thePackage", +referencedClasses: [], +messageSends: [] +}), +$globals.SemanticAnalyzer); + +$core.addMethod( +$core.method({ +selector: "thePackage:", +protocol: 'accessing', +fn: function (aPackage){ +var self=this; +self["@thePackage"]=aPackage; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode"], -source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode", +args: ["aPackage"], +source: "thePackage: aPackage\x0a\x09thePackage := aPackage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ASTPCNodeVisitor); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "visitSendNode:", +selector: "validateVariableScope:", +protocol: 'scope', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$receiver; +$1=$recv(self["@currentScope"])._lookupVariable_(aString); +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +self._errorShadowingVariable_(aString); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)}); +}, +args: ["aString"], +source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]", +referencedClasses: [], +messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"] +}), +$globals.SemanticAnalyzer); + +$core.addMethod( +$core.method({ +selector: "visitAssignmentNode:", protocol: 'visiting', fn: function (aNode){ var self=this; -var sendIndex; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$5; -$1=self._context(); -$2=self._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -sendIndex=$recv($1)._sendIndexAt_($2); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode])); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -$4=self._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq($recv(aNode)._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -if($core.assert($3)){ -$5=$recv(self._index()).__eq(sendIndex); -if($core.assert($5)){ -self["@currentNode"]=aNode; -self["@currentNode"]; -}; -self._increaseIndex(); -}; +$recv($recv(aNode)._left())._beAssigned(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], -source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]", +source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"] +messageSends: ["visitAssignmentNode:", "beAssigned", "left"] }), -$globals.ASTPCNodeVisitor); - +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitBlockNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +self._pushScope_(self._newBlockScope()); +$recv(aNode)._scope_(self["@currentScope"]); +$recv(self["@currentScope"])._node_(aNode); +$recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex()); +$recv($recv(aNode)._parameters())._do_((function(each){ +return $core.withContext(function($ctx2) { +self._validateVariableScope_(each); +return $recv(self["@currentScope"])._addArg_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +self._popScope(); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", +args: ["aNode"], +source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"] }), -$globals.AssignmentNode); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitCascadeNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $3,$2,$1; +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +$3=$recv(aNode)._nodes(); +$ctx1.sendIdx["nodes"]=1; +$2=$recv($3)._first(); +$1=$recv($2)._superSend(); +if($core.assert($1)){ +$recv($recv(aNode)._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._superSend_(true); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", +args: ["aNode"], +source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"] }), -$globals.BlockNode); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitMethodNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +self._pushScope_(self._newMethodScope()); +$recv(aNode)._scope_(self["@currentScope"]); +$recv(self["@currentScope"])._node_(aNode); +$recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self["@currentScope"])._addIVar_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +$recv($recv(aNode)._arguments())._do_((function(each){ +return $core.withContext(function($ctx2) { +self._validateVariableScope_(each); +return $recv(self["@currentScope"])._addArg_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +$recv(aNode)._classReferences_(self._classReferences()); +$recv(aNode)._sendIndexes_(self._messageSends()); +$1=$recv(aNode)._superSends_($recv(self._superSends())._keys()); +self._popScope(); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", +args: ["aNode"], +source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"] }), -$globals.DynamicArrayNode); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitReturnNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; - +return $core.withContext(function($ctx1) { +var $1; +$recv(aNode)._scope_(self["@currentScope"]); +$1=$recv(self["@currentScope"])._isMethodScope(); +if($core.assert($1)){ +$recv(self["@currentScope"])._localReturn_(true); +} else { +$recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]); +}; +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", +args: ["aNode"], +source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"] }), -$globals.DynamicDictionaryNode); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitSendNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; - +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} +return $core.withContext(function($ctx1) { +var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver; +$3=$recv(aNode)._receiver(); +$ctx1.sendIdx["receiver"]=1; +$2=$recv($3)._value(); +$1=$recv($2).__eq("super"); +if($core.assert($1)){ +$recv(aNode)._superSend_(true); +$4=$recv(aNode)._receiver(); +$ctx1.sendIdx["receiver"]=2; +$recv($4)._value_("self"); +$5=self._superSends(); +$ctx1.sendIdx["superSends"]=1; +$6=$recv(aNode)._selector(); +$ctx1.sendIdx["selector"]=1; +$recv($5)._at_ifAbsentPut_($6,(function(){ +return $core.withContext(function($ctx2) { +return $recv($Set())._new(); +$ctx2.sendIdx["new"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$ctx1.sendIdx["at:ifAbsentPut:"]=1; +$8=self._superSends(); +$9=$recv(aNode)._selector(); +$ctx1.sendIdx["selector"]=2; +$7=$recv($8)._at_($9); +$ctx1.sendIdx["at:"]=1; +$recv($7)._add_(aNode); +$ctx1.sendIdx["add:"]=1; +} else { +$11=$recv($IRSendInliner())._inlinedSelectors(); +$12=$recv(aNode)._selector(); +$ctx1.sendIdx["selector"]=3; +$10=$recv($11)._includes_($12); +if($core.assert($10)){ +$recv(aNode)._shouldBeInlined_(true); +$13=$recv(aNode)._receiver(); +if(($receiver = $13) == null || $receiver.isNil){ +$13; +} else { +var receiver; +receiver=$receiver; +$recv(receiver)._shouldBeAliased_(true); +}; +}; +}; +$14=self._messageSends(); +$ctx1.sendIdx["messageSends"]=1; +$15=$recv(aNode)._selector(); +$ctx1.sendIdx["selector"]=4; +$recv($14)._at_ifAbsentPut_($15,(function(){ +return $core.withContext(function($ctx2) { +return $recv($Set())._new(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); +})); +$17=self._messageSends(); +$ctx1.sendIdx["messageSends"]=2; +$18=$recv(aNode)._selector(); +$ctx1.sendIdx["selector"]=5; +$16=$recv($17)._at_($18); +$ctx1.sendIdx["at:"]=2; +$recv($16)._add_(aNode); +$recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size()); +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aNode"], +source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode", +referencedClasses: ["Set", "IRSendInliner"], +messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"] }), -$globals.JSStatementNode); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return false; - +return $core.withContext(function($ctx1) { +$recv($recv(aNode)._temps())._do_((function(each){ +return $core.withContext(function($ctx2) { +self._validateVariableScope_(each); +return $recv(self["@currentScope"])._addTemp_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +( +$ctx1.supercall = true, +$globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ false", +args: ["aNode"], +source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"] }), -$globals.Node); +$globals.SemanticAnalyzer); $core.addMethod( $core.method({ -selector: "isSteppingNode", -protocol: '*Compiler-Interpreter', -fn: function (){ +selector: "visitVariableNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -return true; +var binding; +function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)} +function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)} +return $core.withContext(function($ctx1) { +var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver; +binding=$recv(self["@currentScope"])._lookupVariable_(aNode); +$1=binding; +if(($receiver = $1) == null || $receiver.isNil){ +$3=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=1; +$2=$recv($3)._isCapitalized(); +if($core.assert($2)){ +$4=$recv($ClassRefVar())._new(); +$ctx1.sendIdx["new"]=1; +$5=$4; +$6=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=2; +$recv($5)._name_($6); +$ctx1.sendIdx["name:"]=1; +$7=$recv($4)._yourself(); +$ctx1.sendIdx["yourself"]=1; +binding=$7; +binding; +$8=self._classReferences(); +$9=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=3; +$recv($8)._add_($9); +} else { +self._errorUnknownVariable_(aNode); +$10=$recv($UnknownVar())._new(); +$recv($10)._name_($recv(aNode)._value()); +$11=$recv($10)._yourself(); +binding=$11; +binding; +}; +} else { +$1; +}; +$recv(aNode)._binding_(binding); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)}); +}, +args: ["aNode"], +source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.", +referencedClasses: ["ClassRefVar", "UnknownVar"], +messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"] +}), +$globals.SemanticAnalyzer); + +$core.addMethod( +$core.method({ +selector: "on:", +protocol: 'instance creation', +fn: function (aClass){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._new(); +$recv($2)._theClass_(aClass); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "isSteppingNode\x0a\x09^ true", +args: ["aClass"], +source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["theClass:", "new", "yourself"] }), -$globals.SendNode); +$globals.SemanticAnalyzer.klass); }); -define("amber/parser", ["./boot"], function($boot) { -var $globals = $boot.globals, nil = $boot.nil; -$globals.SmalltalkParser = (function() { - /* - * Generated by PEG.js 0.8.0. - * - * http://pegjs.majda.cz/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - } - - function SyntaxError(message, expected, found, offset, line, column) { - this.message = message; - this.expected = expected; - this.found = found; - this.offset = offset; - this.line = line; - this.column = column; - - this.name = "SyntaxError"; - } - - peg$subclass(SyntaxError, Error); - - function parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - - peg$FAILED = {}, +define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-IR'); +$core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"}; - peg$startRuleFunctions = { start: peg$parsestart }, - peg$startRuleFunction = peg$parsestart, +$core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR'); +$globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph."; +$core.addMethod( +$core.method({ +selector: "alias:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var variable; +function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} +function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} +function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12; +$1=$recv(aNode)._isImmutable(); +if($core.assert($1)){ +$2=self._visit_(aNode); +$ctx1.sendIdx["visit:"]=1; +return $2; +}; +$3=$recv($IRVariable())._new(); +$ctx1.sendIdx["new"]=1; +$4=$3; +$6=$recv($AliasVar())._new(); +$ctx1.sendIdx["new"]=2; +$5=$recv($6)._name_("$".__comma(self._nextAlias())); +$recv($4)._variable_($5); +$7=$recv($3)._yourself(); +$ctx1.sendIdx["yourself"]=1; +variable=$7; +$8=self._sequence(); +$10=$recv($IRAssignment())._new(); +$recv($10)._add_(variable); +$ctx1.sendIdx["add:"]=2; +$recv($10)._add_(self._visit_(aNode)); +$ctx1.sendIdx["add:"]=3; +$11=$recv($10)._yourself(); +$9=$11; +$recv($8)._add_($9); +$ctx1.sendIdx["add:"]=1; +$recv($recv(self._method())._internalVariables())._add_(variable); +$12=variable; +return $12; +}, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable", +referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"], +messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"] +}), +$globals.IRASTTranslator); - peg$c0 = [], - peg$c1 = peg$FAILED, - peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/, - peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" }, - peg$c4 = "\"", - peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c6 = /^[^"]/, - peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c8 = /^[a-zA-Z]/, - peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" }, - peg$c10 = /^[a-zA-Z0-9]/, - peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" }, - peg$c12 = function(first, others) {return first + others.join("");}, - peg$c13 = ":", - peg$c14 = { type: "literal", value: ":", description: "\":\"" }, - peg$c15 = function(first, last) {return first + last;}, - peg$c16 = /^[a-zA-Z0-9:]/, - peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" }, - peg$c18 = /^[A-Z]/, - peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" }, - peg$c20 = "'", - peg$c21 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c22 = "''", - peg$c23 = { type: "literal", value: "''", description: "\"''\"" }, - peg$c24 = function() {return "'";}, - peg$c25 = /^[^']/, - peg$c26 = { type: "class", value: "[^']", description: "[^']" }, - peg$c27 = function(val) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(val.join("")); - }, - peg$c28 = "$", - peg$c29 = { type: "literal", value: "$", description: "\"$\"" }, - peg$c30 = { type: "any", description: "any character" }, - peg$c31 = function(char) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(char); - }, - peg$c32 = "#", - peg$c33 = { type: "literal", value: "#", description: "\"#\"" }, - peg$c34 = function(rest) {return rest;}, - peg$c35 = function(node) {return node._value();}, - peg$c36 = function(val) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(val); - }, - peg$c37 = function(n) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(n); - }, - peg$c38 = "e", - peg$c39 = { type: "literal", value: "e", description: "\"e\"" }, - peg$c40 = function(n) {return parseFloat(n.join(""));}, - peg$c41 = null, - peg$c42 = "-", - peg$c43 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c44 = "16r", - peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" }, - peg$c46 = /^[0-9a-fA-F]/, - peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" }, - peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);}, - peg$c49 = /^[0-9]/, - peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c51 = ".", - peg$c52 = { type: "literal", value: ".", description: "\".\"" }, - peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);}, - peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));}, - peg$c55 = "#(", - peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" }, - peg$c57 = "(", - peg$c58 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c59 = function(lit) {return lit._value();}, - peg$c60 = ")", - peg$c61 = { type: "literal", value: ")", description: "\")\"" }, - peg$c62 = function(lits) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(lits); - }, - peg$c63 = "{", - peg$c64 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c65 = "}", - peg$c66 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c67 = function(expressions) { - return $globals.DynamicArrayNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._nodes_(expressions || []); - }, - peg$c68 = "#{", - peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" }, - peg$c70 = function(expressions) { - return $globals.DynamicDictionaryNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._nodes_(expressions || []); - }, - peg$c71 = "true", - peg$c72 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c73 = function() {return true;}, - peg$c74 = "false", - peg$c75 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c76 = function() {return false;}, - peg$c77 = "nil", - peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" }, - peg$c79 = function() {return nil;}, - peg$c80 = function(val) { - return $globals.ValueNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(val); - }, - peg$c81 = function(identifier) { - return $globals.VariableNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._value_(identifier); - }, - peg$c82 = function(key, arg) {return {key:key, arg:arg};}, - peg$c83 = /^[\\+*\/=><,@%~|&\-]/, - peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" }, - peg$c85 = function(bin) {return bin.join("");}, - peg$c86 = function(pairs) { - var keywords = []; - var params = []; - var i = 0; - for(i = 0; i < pairs.length; i++){ - keywords.push(pairs[i].key); - } - for(i = 0; i < pairs.length; i++){ - params.push(pairs[i].arg); - } - return [keywords.join(""), params]; - }, - peg$c87 = function(selector, arg) {return [selector, [arg]];}, - peg$c88 = function(selector) {return [selector, []];}, - peg$c89 = function(expression) {return expression;}, - peg$c90 = function(first, others) { return [first].concat(others); }, - peg$c91 = ":=", - peg$c92 = { type: "literal", value: ":=", description: "\":=\"" }, - peg$c93 = function(variable, expression) { - return $globals.AssignmentNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._left_(variable) - ._right_(expression); - }, - peg$c94 = "^", - peg$c95 = { type: "literal", value: "^", description: "\"^\"" }, - peg$c96 = function(expression) { - return $globals.ReturnNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._nodes_([expression]); - }, - peg$c97 = "|", - peg$c98 = { type: "literal", value: "|", description: "\"|\"" }, - peg$c99 = function(variable) {return variable;}, - peg$c100 = function(vars) {return vars;}, - peg$c101 = function(param) {return param;}, - peg$c102 = function(params) {return params;}, - peg$c103 = function(ret) {return [ret];}, - peg$c104 = function(exps, ret) { - var expressions = exps; - expressions.push(ret); - return expressions; - }, - peg$c105 = function(expressions) { - return expressions || []; - }, - peg$c106 = function(temps, statements) { - return $globals.SequenceNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._temps_(temps || []) - ._nodes_(statements || []); - }, - peg$c107 = "[", - peg$c108 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c109 = "]", - peg$c110 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c111 = function(params, sequence) { - return $globals.BlockNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._parameters_(params || []) - ._nodes_([sequence._asBlockSequenceNode()]); - }, - peg$c112 = void 0, - peg$c113 = function(selector) { - return $globals.SendNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._selector_(selector); - }, - peg$c114 = function(message, tail) { - if(tail) { - return tail._valueForReceiver_(message); - } - else { - return message; - } - }, - peg$c115 = function(receiver, tail) { - if(tail) { - return tail._valueForReceiver_(receiver); - } - else { - return receiver; - } - }, - peg$c116 = function(selector, arg) { - return $globals.SendNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._selector_(selector) - ._arguments_([arg]); - }, - peg$c117 = function(message, tail) { - if(tail) { - return tail._valueForReceiver_(message); - } - else { - return message; - } - }, - peg$c118 = function(pairs) { - var selector = []; - var args = []; - for(var i = 0; i < pairs.length; i++) { - selector.push(pairs[i].key); - args.push(pairs[i].arg); - } - return $globals.SendNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._selector_(selector.join("")) - ._arguments_(args); - }, - peg$c119 = function(receiver, tail) { - return tail._valueForReceiver_(receiver); - }, - peg$c120 = ";", - peg$c121 = { type: "literal", value: ";", description: "\";\"" }, - peg$c122 = function(mess) {return mess;}, - peg$c123 = function(send, messages) { - var cascade = []; - cascade.push(send); - for(var i = 0; i < messages.length; i++) { - cascade.push(messages[i]); - } - return $globals.CascadeNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._receiver_(send._receiver()) - ._nodes_(cascade); - }, - peg$c124 = "<", - peg$c125 = { type: "literal", value: "<", description: "\"<\"" }, - peg$c126 = ">>", - peg$c127 = { type: "literal", value: ">>", description: "\">>\"" }, - peg$c128 = function() {return ">";}, - peg$c129 = /^[^>]/, - peg$c130 = { type: "class", value: "[^>]", description: "[^>]" }, - peg$c131 = ">", - peg$c132 = { type: "literal", value: ">", description: "\">\"" }, - peg$c133 = function(val) { - return $globals.JSStatementNode._new() - ._position_((line()).__at(column())) - ._source_(val.join("")) - }, - peg$c134 = function(pattern, sequence) { - return $globals.MethodNode._new() - ._position_((line()).__at(column())) - ._source_(text()) - ._selector_(pattern[0]) - ._arguments_(pattern[1]) - ._nodes_([sequence]); - }, - peg$c135 = function(send) { return send._selector() === "->" }, - peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; }, - peg$c137 = function(first, others) { return first.concat.apply(first, others); }, - - peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, +$core.addMethod( +$core.method({ +selector: "aliasTemporally:", +protocol: 'visiting', +fn: function (aCollection){ +var self=this; +var threshold,result; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} +return $core.withContext(function($ctx1) { +var $1,$2,$4,$3,$5; +threshold=(0); +$recv(aCollection)._withIndexDo_((function(each,i){ +return $core.withContext(function($ctx2) { +$1=$recv(each)._subtreeNeedsAliasing(); +if($core.assert($1)){ +threshold=i; +return threshold; +}; +}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)}); +})); +$ctx1.sendIdx["withIndexDo:"]=1; +result=$recv($OrderedCollection())._new(); +$recv(aCollection)._withIndexDo_((function(each,i){ +return $core.withContext(function($ctx2) { +$2=result; +$4=$recv(i).__lt_eq(threshold); +if($core.assert($4)){ +$3=self._alias_(each); +} else { +$3=self._visit_(each); +}; +return $recv($2)._add_($3); +}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)}); +})); +$5=result; +return $5; +}, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)}); +}, +args: ["aCollection"], +source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result", +referencedClasses: ["OrderedCollection"], +messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"] +}), +$globals.IRASTTranslator); - peg$cache = {}, - peg$result; +$core.addMethod( +$core.method({ +selector: "method", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@method"]; +return $1; - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } +}, +args: [], +source: "method\x0a\x09^ method", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } +$core.addMethod( +$core.method({ +selector: "method:", +protocol: 'accessing', +fn: function (anIRMethod){ +var self=this; +self["@method"]=anIRMethod; +return self; - function text() { - return input.substring(peg$reportedPos, peg$currPos); - } +}, +args: ["anIRMethod"], +source: "method: anIRMethod\x0a\x09method := anIRMethod", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - function offset() { - return peg$reportedPos; - } +$core.addMethod( +$core.method({ +selector: "nextAlias", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$receiver; +$1=self["@nextAlias"]; +if(($receiver = $1) == null || $receiver.isNil){ +self["@nextAlias"]=(0); +self["@nextAlias"]; +} else { +$1; +}; +self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1)); +$2=$recv(self["@nextAlias"])._asString(); +return $2; +}, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)}); +}, +args: [], +source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString", +referencedClasses: [], +messageSends: ["ifNil:", "+", "asString"] +}), +$globals.IRASTTranslator); - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } +$core.addMethod( +$core.method({ +selector: "sequence", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@sequence"]; +return $1; - function column() { - return peg$computePosDetails(peg$reportedPos).column; - } +}, +args: [], +source: "sequence\x0a\x09^ sequence", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - peg$reportedPos - ); - } +$core.addMethod( +$core.method({ +selector: "sequence:", +protocol: 'accessing', +fn: function (anIRSequence){ +var self=this; +self["@sequence"]=anIRSequence; +return self; - function error(message) { - throw peg$buildException(message, null, peg$reportedPos); - } +}, +args: ["anIRSequence"], +source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; +$core.addMethod( +$core.method({ +selector: "source", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@source"]; +return $1; - for (p = startPos; p < endPos; p++) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } - } - } +}, +args: [], +source: "source\x0a\x09^ source", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; - } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; - } +$core.addMethod( +$core.method({ +selector: "source:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@source"]=aString; +return self; - return peg$cachedPosDetails; - } - - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } - - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } +}, +args: ["aString"], +source: "source: aString\x0a\x09source := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - peg$maxFailExpected.push(expected); - } +$core.addMethod( +$core.method({ +selector: "theClass", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@theClass"]; +return $1; - function peg$buildException(message, expected, pos) { - function cleanupExpected(expected) { - var i = 1; +}, +args: [], +source: "theClass\x0a\x09^ theClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); +$core.addMethod( +$core.method({ +selector: "theClass:", +protocol: 'accessing', +fn: function (aClass){ +var self=this; +self["@theClass"]=aClass; +return self; - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } +}, +args: ["aClass"], +source: "theClass: aClass\x0a\x09theClass := aClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRASTTranslator); - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } +$core.addMethod( +$core.method({ +selector: "visitAssignmentNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var left,right,assignment; +function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} +return $core.withContext(function($ctx1) { +var $1,$3,$4,$2,$5; +right=self._visit_($recv(aNode)._right()); +$ctx1.sendIdx["visit:"]=1; +left=self._visit_($recv(aNode)._left()); +$1=self._sequence(); +$3=$recv($IRAssignment())._new(); +$recv($3)._add_(left); +$ctx1.sendIdx["add:"]=2; +$recv($3)._add_(right); +$4=$recv($3)._yourself(); +$2=$4; +$recv($1)._add_($2); +$ctx1.sendIdx["add:"]=1; +$5=left; +return $5; +}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left", +referencedClasses: ["IRAssignment"], +messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"] +}), +$globals.IRASTTranslator); - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } +$core.addMethod( +$core.method({ +selector: "visitBlockNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var closure; +function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} +function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$6,$5,$7,$8,$9; +$1=$recv($IRClosure())._new(); +$ctx1.sendIdx["new"]=1; +$recv($1)._arguments_($recv(aNode)._parameters()); +$recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext()); +$2=$1; +$3=$recv(aNode)._scope(); +$ctx1.sendIdx["scope"]=1; +$recv($2)._scope_($3); +$ctx1.sendIdx["scope:"]=1; +$4=$recv($1)._yourself(); +$ctx1.sendIdx["yourself"]=1; +closure=$4; +$6=$recv(aNode)._scope(); +$ctx1.sendIdx["scope"]=2; +$5=$recv($6)._temps(); +$recv($5)._do_((function(each){ +return $core.withContext(function($ctx2) { +$7=$recv($IRTempDeclaration())._new(); +$recv($7)._name_($recv(each)._name()); +$recv($7)._scope_($recv(aNode)._scope()); +$8=$recv($7)._yourself(); +return $recv(closure)._add_($8); +$ctx2.sendIdx["add:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +$recv($recv(aNode)._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(closure)._add_(self._visit_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$9=closure; +return $9; +}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure", +referencedClasses: ["IRClosure", "IRTempDeclaration"], +messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"] +}), +$globals.IRASTTranslator); - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; +$core.addMethod( +$core.method({ +selector: "visitBlockSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} +function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)} +return $core.withContext(function($ctx1) { +var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1; +$2=$recv($IRBlockSequence())._new(); +$ctx1.sendIdx["new"]=1; +$1=self._withSequence_do_($2,(function(){ +return $core.withContext(function($ctx2) { +$3=$recv(aNode)._nodes(); +$ctx2.sendIdx["nodes"]=1; +return $recv($3)._ifNotEmpty_((function(){ +return $core.withContext(function($ctx3) { +$5=$recv(aNode)._nodes(); +$ctx3.sendIdx["nodes"]=2; +$4=$recv($5)._allButLast(); +$recv($4)._do_((function(each){ +return $core.withContext(function($ctx4) { +$6=self._sequence(); +$ctx4.sendIdx["sequence"]=1; +$7=self._visitOrAlias_(each); +$ctx4.sendIdx["visitOrAlias:"]=1; +return $recv($6)._add_($7); +$ctx4.sendIdx["add:"]=1; +}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)}); +})); +$10=$recv(aNode)._nodes(); +$ctx3.sendIdx["nodes"]=3; +$9=$recv($10)._last(); +$ctx3.sendIdx["last"]=1; +$8=$recv($9)._isReturnNode(); +if($core.assert($8)){ +return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last())); +} else { +$11=self._sequence(); +$ctx3.sendIdx["sequence"]=2; +$13=$recv($IRBlockReturn())._new(); +$14=$13; +$17=$recv(aNode)._nodes(); +$ctx3.sendIdx["nodes"]=4; +$16=$recv($17)._last(); +$ctx3.sendIdx["last"]=2; +$15=self._visitOrAlias_($16); +$ctx3.sendIdx["visitOrAlias:"]=2; +$recv($14)._add_($15); +$ctx3.sendIdx["add:"]=3; +$18=$recv($13)._yourself(); +$12=$18; +return $recv($11)._add_($12); +$ctx3.sendIdx["add:"]=2; +}; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]", +referencedClasses: ["IRBlockSequence", "IRBlockReturn"], +messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"] +}), +$globals.IRASTTranslator); - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } +$core.addMethod( +$core.method({ +selector: "visitCascadeNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var alias,receiver; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +return $core.withContext(function($ctx1) { +var $2,$1,$3,$5,$4,$6; +$2=$recv(aNode)._receiver(); +$ctx1.sendIdx["receiver"]=1; +$1=$recv($2)._isImmutable(); +if($core.assert($1)){ +receiver=$recv(aNode)._receiver(); +$ctx1.sendIdx["receiver"]=2; +receiver; +} else { +alias=self._alias_($recv(aNode)._receiver()); +$ctx1.sendIdx["alias:"]=1; +alias; +receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable()); +receiver; +}; +$3=$recv(aNode)._nodes(); +$ctx1.sendIdx["nodes"]=1; +$recv($3)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._receiver_(receiver); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); +})); +$ctx1.sendIdx["do:"]=1; +$5=$recv(aNode)._nodes(); +$ctx1.sendIdx["nodes"]=2; +$4=$recv($5)._allButLast(); +$recv($4)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self._sequence())._add_(self._visit_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); +})); +$6=self._alias_($recv($recv(aNode)._nodes())._last()); +return $6; +}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last", +referencedClasses: ["VariableNode"], +messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"] +}), +$globals.IRASTTranslator); - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; +$core.addMethod( +$core.method({ +selector: "visitDynamicArrayNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var array; +function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)} +return $core.withContext(function($ctx1) { +var $1; +array=$recv($IRDynamicArray())._new(); +$recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(array)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$1=array; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array", +referencedClasses: ["IRDynamicArray"], +messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"] +}), +$globals.IRASTTranslator); - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; +$core.addMethod( +$core.method({ +selector: "visitDynamicDictionaryNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var dictionary; +function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)} +return $core.withContext(function($ctx1) { +var $1; +dictionary=$recv($IRDynamicDictionary())._new(); +$recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(dictionary)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$1=dictionary; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary", +referencedClasses: ["IRDynamicDictionary"], +messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"] +}), +$globals.IRASTTranslator); - return "Expected " + expectedDesc + " but " + foundDesc + " found."; - } +$core.addMethod( +$core.method({ +selector: "visitJSStatementNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRVerbatim())._new(); +$recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself", +referencedClasses: ["IRVerbatim"], +messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"] +}), +$globals.IRASTTranslator); - var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; +$core.addMethod( +$core.method({ +selector: "visitMethodNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)} +function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} +function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} +function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} +function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)} +return $core.withContext(function($ctx1) { +var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29; +$2=$recv($IRMethod())._new(); +$ctx1.sendIdx["new"]=1; +$recv($2)._source_($recv(self._source())._crlfSanitized()); +$ctx1.sendIdx["source:"]=1; +$recv($2)._theClass_(self._theClass()); +$recv($2)._arguments_($recv(aNode)._arguments()); +$recv($2)._selector_($recv(aNode)._selector()); +$recv($2)._sendIndexes_($recv(aNode)._sendIndexes()); +$recv($2)._superSends_($recv(aNode)._superSends()); +$recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext()); +$recv($2)._classReferences_($recv(aNode)._classReferences()); +$3=$2; +$4=$recv(aNode)._scope(); +$ctx1.sendIdx["scope"]=1; +$recv($3)._scope_($4); +$ctx1.sendIdx["scope:"]=1; +$5=$recv($2)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$1=$5; +self._method_($1); +$7=$recv(aNode)._scope(); +$ctx1.sendIdx["scope"]=2; +$6=$recv($7)._temps(); +$recv($6)._do_((function(each){ +return $core.withContext(function($ctx2) { +$8=self._method(); +$ctx2.sendIdx["method"]=1; +$10=$recv($IRTempDeclaration())._new(); +$ctx2.sendIdx["new"]=2; +$recv($10)._name_($recv(each)._name()); +$11=$10; +$12=$recv(aNode)._scope(); +$ctx2.sendIdx["scope"]=3; +$recv($11)._scope_($12); +$13=$recv($10)._yourself(); +$ctx2.sendIdx["yourself"]=2; +$9=$13; +return $recv($8)._add_($9); +$ctx2.sendIdx["add:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +$recv($recv(aNode)._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +$14=self._method(); +$ctx2.sendIdx["method"]=2; +return $recv($14)._add_(self._visit_(each)); +$ctx2.sendIdx["add:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$16=$recv(aNode)._scope(); +$ctx1.sendIdx["scope"]=4; +$15=$recv($16)._hasLocalReturn(); +if(!$core.assert($15)){ +$17=self._method(); +$ctx1.sendIdx["method"]=3; +$18=$17; +$20=$recv($IRReturn())._new(); +$ctx1.sendIdx["new"]=3; +$21=$20; +$23=$recv($IRVariable())._new(); +$ctx1.sendIdx["new"]=4; +$recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self")); +$24=$recv($23)._yourself(); +$ctx1.sendIdx["yourself"]=3; +$22=$24; +$recv($21)._add_($22); +$ctx1.sendIdx["add:"]=4; +$25=$recv($20)._yourself(); +$ctx1.sendIdx["yourself"]=4; +$19=$25; +$recv($18)._add_($19); +$ctx1.sendIdx["add:"]=3; +$27=$recv($IRVerbatim())._new(); +$recv($27)._source_(""); +$28=$recv($27)._yourself(); +$26=$recv($17)._add_($28); +$26; +}; +$29=self._method(); +return $29; +}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method", +referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"], +messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"] +}), +$globals.IRASTTranslator); - if (expected !== null) { - cleanupExpected(expected); - } +$core.addMethod( +$core.method({ +selector: "visitOrAlias:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv(aNode)._shouldBeAliased(); +if($core.assert($2)){ +$1=self._alias_(aNode); +} else { +$1=self._visit_(aNode); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"] +}), +$globals.IRASTTranslator); - return new SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - pos, - posDetails.line, - posDetails.column - ); - } +$core.addMethod( +$core.method({ +selector: "visitReturnNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var return_; +function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)} +function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} +return $core.withContext(function($ctx1) { +var $1,$2; +$1=$recv(aNode)._nonLocalReturn(); +if($core.assert($1)){ +return_=$recv($IRNonLocalReturn())._new(); +$ctx1.sendIdx["new"]=1; +} else { +return_=$recv($IRReturn())._new(); +}; +$recv(return_)._scope_($recv(aNode)._scope()); +$recv($recv(aNode)._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(return_)._add_(self._alias_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); +})); +$2=return_; +return $2; +}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return", +referencedClasses: ["IRNonLocalReturn", "IRReturn"], +messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"] +}), +$globals.IRASTTranslator); - function peg$parsestart() { - var s0; +$core.addMethod( +$core.method({ +selector: "visitSendNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +var send,all,receiver,arguments_; +function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +send=$recv($IRSend())._new(); +$1=send; +$recv($1)._selector_($recv(aNode)._selector()); +$2=$recv($1)._index_($recv(aNode)._index()); +$3=$recv(aNode)._superSend(); +if($core.assert($3)){ +$recv(send)._classSend_($recv(self._theClass())._superclass()); +}; +all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments())); +receiver=$recv(all)._first(); +arguments_=$recv(all)._allButFirst(); +$recv(send)._add_(receiver); +$ctx1.sendIdx["add:"]=1; +$recv(arguments_)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(send)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$4=send; +return $4; +}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send", +referencedClasses: ["IRSend"], +messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"] +}), +$globals.IRASTTranslator); - var key = peg$currPos * 60 + 0, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)} +return $core.withContext(function($ctx1) { +var $2,$1; +$1=self._withSequence_do_($recv($IRSequence())._new(),(function(){ +return $core.withContext(function($ctx2) { +return $recv($recv(aNode)._nodes())._do_((function(each){ +var instruction; +return $core.withContext(function($ctx3) { +instruction=self._visitOrAlias_(each); +instruction; +$2=$recv(instruction)._isVariable(); +if(!$core.assert($2)){ +return $recv(self._sequence())._add_(instruction); +}; +}, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]", +referencedClasses: ["IRSequence"], +messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"] +}), +$globals.IRASTTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitValueNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRValue())._new(); +$recv($2)._value_($recv(aNode)._value()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself", +referencedClasses: ["IRValue"], +messageSends: ["value:", "new", "value", "yourself"] +}), +$globals.IRASTTranslator); - s0 = peg$parsemethod(); +$core.addMethod( +$core.method({ +selector: "visitVariableNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRVariable())._new(); +$recv($2)._variable_($recv(aNode)._binding()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)}); +}, +args: ["aNode"], +source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself", +referencedClasses: ["IRVariable"], +messageSends: ["variable:", "new", "binding", "yourself"] +}), +$globals.IRASTTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "withSequence:do:", +protocol: 'accessing', +fn: function (aSequence,aBlock){ +var self=this; +var outerSequence; +return $core.withContext(function($ctx1) { +outerSequence=self._sequence(); +self._sequence_(aSequence); +$ctx1.sendIdx["sequence:"]=1; +$recv(aBlock)._value(); +self._sequence_(outerSequence); +return aSequence; +}, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)}); +}, +args: ["aSequence", "aBlock"], +source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence", +referencedClasses: [], +messageSends: ["sequence", "sequence:", "value"] +}), +$globals.IRASTTranslator); - return s0; - } - function peg$parseseparator() { - var s0, s1; - var key = peg$currPos * 60 + 1, - cached = peg$cache[key]; +$core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR'); +$globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRInstruction_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "add:", +protocol: 'building', +fn: function (anObject){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$recv(anObject)._parent_(self); +$1=$recv(self._instructions())._add_(anObject); +return $1; +}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)}); +}, +args: ["anObject"], +source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject", +referencedClasses: [], +messageSends: ["parent:", "add:", "instructions"] +}), +$globals.IRInstruction); - s0 = []; - if (peg$c2.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c3); } - } - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - if (peg$c2.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c3); } - } - } - } else { - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "canBeAssigned", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "canBeAssigned\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - return s0; - } +$core.addMethod( +$core.method({ +selector: "instructions", +protocol: 'accessing', +fn: function (){ +var self=this; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@instructions"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@instructions"]=$recv($OrderedCollection())._new(); +$1=self["@instructions"]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)}); +}, +args: [], +source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]", +referencedClasses: ["OrderedCollection"], +messageSends: ["ifNil:", "new"] +}), +$globals.IRInstruction); - function peg$parsecomments() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "isClosure", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - var key = peg$currPos * 60 + 2, - cached = peg$cache[key]; +}, +args: [], +source: "isClosure\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - s0 = []; - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c4; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c6.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c6.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s4 = peg$c4; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } - } - if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c4; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c6.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c6.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s4 = peg$c4; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } - } - if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } - } else { - s0 = peg$c1; - } +}, +args: [], +source: "isInlined\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isLocalReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - return s0; - } +}, +args: [], +source: "isLocalReturn\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - function peg$parsews() { - var s0, s1; +$core.addMethod( +$core.method({ +selector: "isMethod", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - var key = peg$currPos * 60 + 3, - cached = peg$cache[key]; +}, +args: [], +source: "isMethod\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - s0 = []; - s1 = peg$parseseparator(); - if (s1 === peg$FAILED) { - s1 = peg$parsecomments(); - } - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseseparator(); - if (s1 === peg$FAILED) { - s1 = peg$parsecomments(); - } - } +}, +args: [], +source: "isReturn\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isSend", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - return s0; - } +}, +args: [], +source: "isSend\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - function peg$parseidentifier() { - var s0, s1, s2, s3; +$core.addMethod( +$core.method({ +selector: "isSequence", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - var key = peg$currPos * 60 + 4, - cached = peg$cache[key]; +}, +args: [], +source: "isSequence\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isTempDeclaration", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - s0 = peg$currPos; - if (peg$c8.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c10.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c10.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c12(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: [], +source: "isTempDeclaration\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isVariable", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - return s0; - } +}, +args: [], +source: "isVariable\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - function peg$parsekeyword() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "method", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._parent())._method(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)}); +}, +args: [], +source: "method\x0a\x09^ self parent method", +referencedClasses: [], +messageSends: ["method", "parent"] +}), +$globals.IRInstruction); - var key = peg$currPos * 60 + 5, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "needsBoxingAsReceiver", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "needsBoxingAsReceiver\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - s0 = peg$currPos; - s1 = peg$parseidentifier(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s2 = peg$c13; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "parent", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@parent"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "parent\x0a\x09^ parent", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - return s0; - } +$core.addMethod( +$core.method({ +selector: "parent:", +protocol: 'accessing', +fn: function (anIRInstruction){ +var self=this; +self["@parent"]=anIRInstruction; +return self; - function peg$parseselector() { - var s0, s1, s2, s3; +}, +args: ["anIRInstruction"], +source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInstruction); - var key = peg$currPos * 60 + 6, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "remove", +protocol: 'building', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._parent())._remove_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)}); +}, +args: [], +source: "remove\x0a\x09self parent remove: self", +referencedClasses: [], +messageSends: ["remove:", "parent"] +}), +$globals.IRInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "remove:", +protocol: 'building', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._instructions())._remove_(anIRInstruction); +return self; +}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)}); +}, +args: ["anIRInstruction"], +source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction", +referencedClasses: [], +messageSends: ["remove:", "instructions"] +}), +$globals.IRInstruction); - s0 = peg$currPos; - if (peg$c8.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c16.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c16.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c12(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "replace:with:", +protocol: 'building', +fn: function (anIRInstruction,anotherIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$recv(anotherIRInstruction)._parent_(self); +$1=self._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction); +return self; +}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)}); +}, +args: ["anIRInstruction", "anotherIRInstruction"], +source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction", +referencedClasses: [], +messageSends: ["parent:", "at:put:", "instructions", "indexOf:"] +}), +$globals.IRInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "replaceWith:", +protocol: 'building', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._parent())._replace_with_(self,anIRInstruction); +return self; +}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)}); +}, +args: ["anIRInstruction"], +source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction", +referencedClasses: [], +messageSends: ["replace:with:", "parent"] +}), +$globals.IRInstruction); - return s0; - } +$core.addMethod( +$core.method({ +selector: "scope", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self._parent(); +if(($receiver = $2) == null || $receiver.isNil){ +$1=$2; +} else { +var node; +node=$receiver; +$1=$recv(node)._scope(); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)}); +}, +args: [], +source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]", +referencedClasses: [], +messageSends: ["ifNotNil:", "parent", "scope"] +}), +$globals.IRInstruction); - function peg$parseclassName() { - var s0, s1, s2, s3; - var key = peg$currPos * 60 + 7, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "on:", +protocol: 'instance creation', +fn: function (aBuilder){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._new(); +$recv($2)._builder_(aBuilder); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)}); +}, +args: ["aBuilder"], +source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself", +referencedClasses: [], +messageSends: ["builder:", "new", "yourself"] +}), +$globals.IRInstruction.klass); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - if (peg$c18.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c10.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c10.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c12(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRAssignment_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self", +referencedClasses: [], +messageSends: ["visitIRAssignment:"] +}), +$globals.IRAssignment); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsestring() { - var s0, s1, s2, s3, s4; +$core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRDynamicArray_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self", +referencedClasses: [], +messageSends: ["visitIRDynamicArray:"] +}), +$globals.IRDynamicArray); - var key = peg$currPos * 60 + 8, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c20; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c22) { - s4 = peg$c22; - peg$currPos += 2; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c24(); - } - s3 = s4; - if (s3 === peg$FAILED) { - if (peg$c25.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } - } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c22) { - s4 = peg$c22; - peg$currPos += 2; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c24(); - } - s3 = s4; - if (s3 === peg$FAILED) { - if (peg$c25.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } - } - } - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c20; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c27(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsecharacter() { - var s0, s1, s2; +$core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRDynamicDictionary_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self", +referencedClasses: [], +messageSends: ["visitIRDynamicDictionary:"] +}), +$globals.IRDynamicDictionary); - var key = peg$currPos * 60 + 9, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 36) { - s1 = peg$c28; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c31(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "scope", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@scope"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "scope\x0a\x09^ scope", +referencedClasses: [], +messageSends: [] +}), +$globals.IRScopedInstruction); - return s0; - } +$core.addMethod( +$core.method({ +selector: "scope:", +protocol: 'accessing', +fn: function (aScope){ +var self=this; +self["@scope"]=aScope; +return self; - function peg$parsesymbol() { - var s0, s1, s2; +}, +args: ["aScope"], +source: "scope: aScope\x0a\x09scope := aScope", +referencedClasses: [], +messageSends: [] +}), +$globals.IRScopedInstruction); - var key = peg$currPos * 60 + 10, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c32; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsebareSymbol(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "arguments", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@arguments"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=[]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)}); +}, +args: [], +source: "arguments\x0a\x09^ arguments ifNil: [ #() ]", +referencedClasses: [], +messageSends: ["ifNil:"] +}), +$globals.IRClosureInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "arguments:", +protocol: 'accessing', +fn: function (aCollection){ +var self=this; +self["@arguments"]=aCollection; +return self; - return s0; - } +}, +args: ["aCollection"], +source: "arguments: aCollection\x0a\x09arguments := aCollection", +referencedClasses: [], +messageSends: [] +}), +$globals.IRClosureInstruction); - function peg$parsebareSymbol() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "locals", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv(self._arguments())._copy(); +$recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._name(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}))); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)}); +}, +args: [], +source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself", +referencedClasses: [], +messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"] +}), +$globals.IRClosureInstruction); - var key = peg$currPos * 60 + 11, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "requiresSmalltalkContext", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@requiresSmalltalkContext"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)}); +}, +args: [], +source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]", +referencedClasses: [], +messageSends: ["ifNil:"] +}), +$globals.IRClosureInstruction); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "requiresSmalltalkContext:", +protocol: 'accessing', +fn: function (anObject){ +var self=this; +self["@requiresSmalltalkContext"]=anObject; +return self; - s0 = peg$currPos; - s1 = peg$parseselector(); - if (s1 === peg$FAILED) { - s1 = peg$parsebinarySelector(); - if (s1 === peg$FAILED) { - s1 = peg$currPos; - s2 = peg$parsestring(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s1; - s2 = peg$c35(s2); - } - s1 = s2; - } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c36(s1); - } - s0 = s1; +}, +args: ["anObject"], +source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject", +referencedClasses: [], +messageSends: [] +}), +$globals.IRClosureInstruction); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "scope:", +protocol: 'accessing', +fn: function (aScope){ +var self=this; +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope])); +$ctx1.supercall = false; +$recv(aScope)._instruction_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)}); +}, +args: ["aScope"], +source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self", +referencedClasses: [], +messageSends: ["scope:", "instruction:"] +}), +$globals.IRClosureInstruction); - return s0; - } +$core.addMethod( +$core.method({ +selector: "tempDeclarations", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._instructions())._select_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._isTempDeclaration(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)}); +}, +args: [], +source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]", +referencedClasses: [], +messageSends: ["select:", "instructions", "isTempDeclaration"] +}), +$globals.IRClosureInstruction); - function peg$parsenumber() { - var s0, s1; - var key = peg$currPos * 60 + 12, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRClosure_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self", +referencedClasses: [], +messageSends: ["visitIRClosure:"] +}), +$globals.IRClosure); - s0 = peg$currPos; - s1 = peg$parsenumberExp(); - if (s1 === peg$FAILED) { - s1 = peg$parsehex(); - if (s1 === peg$FAILED) { - s1 = peg$parsefloat(); - if (s1 === peg$FAILED) { - s1 = peg$parseinteger(); - } - } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c37(s1); - } - s0 = s1; +$core.addMethod( +$core.method({ +selector: "isClosure", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "isClosure\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRClosure); - return s0; - } +$core.addMethod( +$core.method({ +selector: "sequence", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._instructions())._last(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)}); +}, +args: [], +source: "sequence\x0a\x09^ self instructions last", +referencedClasses: [], +messageSends: ["last", "instructions"] +}), +$globals.IRClosure); - function peg$parsenumberExp() { - var s0, s1, s2, s3, s4; - var key = peg$currPos * 60 + 13, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR'); +$globals.IRMethod.comment="I am a method instruction"; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRMethod_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self", +referencedClasses: [], +messageSends: ["visitIRMethod:"] +}), +$globals.IRMethod); - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$parsefloat(); - if (s2 === peg$FAILED) { - s2 = peg$parseinteger(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 101) { - s3 = peg$c38; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parseinteger(); - if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - } else { - peg$currPos = s1; - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c40(s1); - } - s0 = s1; +$core.addMethod( +$core.method({ +selector: "classReferences", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@classReferences"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "classReferences\x0a\x09^ classReferences", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - return s0; - } +$core.addMethod( +$core.method({ +selector: "classReferences:", +protocol: 'accessing', +fn: function (aCollection){ +var self=this; +self["@classReferences"]=aCollection; +return self; - function peg$parsehex() { - var s0, s1, s2, s3, s4; +}, +args: ["aCollection"], +source: "classReferences: aCollection\x0a\x09classReferences := aCollection", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - var key = peg$currPos * 60 + 14, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "internalVariables", +protocol: 'accessing', +fn: function (){ +var self=this; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@internalVariables"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@internalVariables"]=$recv($Set())._new(); +$1=self["@internalVariables"]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)}); +}, +args: [], +source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]", +referencedClasses: ["Set"], +messageSends: ["ifNil:", "new"] +}), +$globals.IRMethod); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isMethod", +protocol: 'accessing', +fn: function (){ +var self=this; +return true; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c42; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s1 === peg$FAILED) { - s1 = peg$c41; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c44) { - s2 = peg$c44; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c46.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } - } - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c46.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } - } - } - } else { - s3 = peg$c1; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c48(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: [], +source: "isMethod\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "messageSends", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._sendIndexes())._keys(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)}); +}, +args: [], +source: "messageSends\x0a\x09^ self sendIndexes keys", +referencedClasses: [], +messageSends: ["keys", "sendIndexes"] +}), +$globals.IRMethod); - return s0; - } +$core.addMethod( +$core.method({ +selector: "method", +protocol: 'accessing', +fn: function (){ +var self=this; +return self; - function peg$parsefloat() { - var s0, s1, s2, s3, s4, s5; +}, +args: [], +source: "method\x0a\x09^ self", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - var key = peg$currPos * 60 + 15, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "selector", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@selector"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "selector\x0a\x09^ selector", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c42; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s1 === peg$FAILED) { - s1 = peg$c41; - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c49.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c49.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - } - } else { - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s3 !== peg$FAILED) { - s4 = []; - if (peg$c49.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - if (s5 !== peg$FAILED) { - while (s5 !== peg$FAILED) { - s4.push(s5); - if (peg$c49.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - } - } else { - s4 = peg$c1; - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c53(s1, s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "selector:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@selector"]=aString; +return self; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: ["aString"], +source: "selector: aString\x0a\x09selector := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - return s0; - } +$core.addMethod( +$core.method({ +selector: "sendIndexes", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@sendIndexes"]; +return $1; - function peg$parseinteger() { - var s0, s1, s2, s3; +}, +args: [], +source: "sendIndexes\x0a\x09^ sendIndexes", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - var key = peg$currPos * 60 + 16, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "sendIndexes:", +protocol: 'accessing', +fn: function (aDictionary){ +var self=this; +self["@sendIndexes"]=aDictionary; +return self; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: ["aDictionary"], +source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c42; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s1 === peg$FAILED) { - s1 = peg$c41; - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c49.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c49.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - } - } else { - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c54(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "source", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@source"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "source\x0a\x09^ source", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - return s0; - } +$core.addMethod( +$core.method({ +selector: "source:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@source"]=aString; +return self; - function peg$parseliteralArray() { - var s0, s1, s2; +}, +args: ["aString"], +source: "source: aString\x0a\x09source := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - var key = peg$currPos * 60 + 17, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "superSends", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@superSends"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "superSends\x0a\x09^ superSends", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c55) { - s1 = peg$c55; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c56); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseliteralArrayRest(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "superSends:", +protocol: 'accessing', +fn: function (aCollection){ +var self=this; +self["@superSends"]=aCollection; +return self; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: ["aCollection"], +source: "superSends: aCollection\x0a\x09superSends := aCollection", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - return s0; - } +$core.addMethod( +$core.method({ +selector: "theClass", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@theClass"]; +return $1; - function peg$parsebareLiteralArray() { - var s0, s1, s2; +}, +args: [], +source: "theClass\x0a\x09^ theClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - var key = peg$currPos * 60 + 18, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "theClass:", +protocol: 'accessing', +fn: function (aClass){ +var self=this; +self["@theClass"]=aClass; +return self; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: ["aClass"], +source: "theClass: aClass\x0a\x09theClass := aClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRMethod); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c57; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseliteralArrayRest(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } +$core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR'); +$globals.IRReturn.comment="I am a local return instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRReturn_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self", +referencedClasses: [], +messageSends: ["visitIRReturn:"] +}), +$globals.IRReturn); - function peg$parseliteralArrayRest() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "canBeAssigned", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - var key = peg$currPos * 60 + 19, - cached = peg$cache[key]; +}, +args: [], +source: "canBeAssigned\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRReturn); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isBlockReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - s0 = peg$currPos; - s1 = []; - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseparseTimeLiteral(); - if (s4 === peg$FAILED) { - s4 = peg$parsebareLiteralArray(); - if (s4 === peg$FAILED) { - s4 = peg$parsebareSymbol(); - } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c59(s4); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseparseTimeLiteral(); - if (s4 === peg$FAILED) { - s4 = peg$parsebareLiteralArray(); - if (s4 === peg$FAILED) { - s4 = peg$parsebareSymbol(); - } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c59(s4); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s3 = peg$c60; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c62(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: [], +source: "isBlockReturn\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRReturn); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isLocalReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - return s0; - } +}, +args: [], +source: "isLocalReturn\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRReturn); - function peg$parsedynamicArray() { - var s0, s1, s2, s3, s4, s5, s6; +$core.addMethod( +$core.method({ +selector: "isNonLocalReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._isLocalReturn())._not(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)}); +}, +args: [], +source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not", +referencedClasses: [], +messageSends: ["not", "isLocalReturn"] +}), +$globals.IRReturn); - var key = peg$currPos * 60 + 20, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "isReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "isReturn\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRReturn); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c63; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseexpressions(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s5 = peg$c51; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s5 === peg$FAILED) { - s5 = peg$c41; - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s6 = peg$c65; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c67(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "scope", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@scope"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$recv(self._parent())._scope(); +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)}); +}, +args: [], +source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]", +referencedClasses: [], +messageSends: ["ifNil:", "scope", "parent"] +}), +$globals.IRReturn); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsedynamicDictionary() { - var s0, s1, s2, s3, s4, s5; +$core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR'); +$globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRBlockReturn_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self", +referencedClasses: [], +messageSends: ["visitIRBlockReturn:"] +}), +$globals.IRBlockReturn); - var key = peg$currPos * 60 + 21, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "isBlockReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "isBlockReturn\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRBlockReturn); - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c68) { - s1 = peg$c68; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseassociations(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c65; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c70(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } +$core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR'); +$globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRNonLocalReturn_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self", +referencedClasses: [], +messageSends: ["visitIRNonLocalReturn:"] +}), +$globals.IRNonLocalReturn); - function peg$parsepseudoVariable() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "isLocalReturn", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - var key = peg$currPos * 60 + 22, - cached = peg$cache[key]; +}, +args: [], +source: "isLocalReturn\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRNonLocalReturn); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c71) { - s2 = peg$c71; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c72); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s1; - s2 = peg$c73(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c74) { - s2 = peg$c74; - peg$currPos += 5; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s1; - s2 = peg$c76(); - } - s1 = s2; - if (s1 === peg$FAILED) { - s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c77) { - s2 = peg$c77; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s1; - s2 = peg$c79(); - } - s1 = s2; - } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c80(s1); - } - s0 = s1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRTempDeclaration_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self", +referencedClasses: [], +messageSends: ["visitIRTempDeclaration:"] +}), +$globals.IRTempDeclaration); - return s0; - } +$core.addMethod( +$core.method({ +selector: "isTempDeclaration", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - function peg$parseparseTimeLiteral() { - var s0; +}, +args: [], +source: "isTempDeclaration\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRTempDeclaration); - var key = peg$currPos * 60 + 23, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "name", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@name"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsepseudoVariable(); - if (s0 === peg$FAILED) { - s0 = peg$parsenumber(); - if (s0 === peg$FAILED) { - s0 = peg$parseliteralArray(); - if (s0 === peg$FAILED) { - s0 = peg$parsestring(); - if (s0 === peg$FAILED) { - s0 = peg$parsesymbol(); - if (s0 === peg$FAILED) { - s0 = peg$parsecharacter(); - } - } - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseruntimeLiteral() { - var s0; +}, +args: [], +source: "name\x0a\x09^ name", +referencedClasses: [], +messageSends: [] +}), +$globals.IRTempDeclaration); - var key = peg$currPos * 60 + 24, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "name:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@name"]=aString; +return self; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: ["aString"], +source: "name: aString\x0a\x09name := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRTempDeclaration); - s0 = peg$parsedynamicDictionary(); - if (s0 === peg$FAILED) { - s0 = peg$parsedynamicArray(); - if (s0 === peg$FAILED) { - s0 = peg$parseblock(); - } - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } +$core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR'); +$globals.IRSend.comment="I am a message send instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRSend_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self", +referencedClasses: [], +messageSends: ["visitIRSend:"] +}), +$globals.IRSend); - function peg$parseliteral() { - var s0; +$core.addMethod( +$core.method({ +selector: "classSend", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@classSend"]; +return $1; - var key = peg$currPos * 60 + 25, - cached = peg$cache[key]; +}, +args: [], +source: "classSend\x0a\x09^ classSend", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "classSend:", +protocol: 'accessing', +fn: function (aClass){ +var self=this; +self["@classSend"]=aClass; +return self; - s0 = peg$parseruntimeLiteral(); - if (s0 === peg$FAILED) { - s0 = peg$parseparseTimeLiteral(); - } +}, +args: ["aClass"], +source: "classSend: aClass\x0a\x09classSend := aClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "index", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@index"]; +return $1; - return s0; - } +}, +args: [], +source: "index\x0a\x09^ index", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - function peg$parsevariable() { - var s0, s1; +$core.addMethod( +$core.method({ +selector: "index:", +protocol: 'accessing', +fn: function (anInteger){ +var self=this; +self["@index"]=anInteger; +return self; - var key = peg$currPos * 60 + 26, - cached = peg$cache[key]; +}, +args: ["anInteger"], +source: "index: anInteger\x0a\x09index := anInteger", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "isSend", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - s0 = peg$currPos; - s1 = peg$parseidentifier(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c81(s1); - } - s0 = s1; +}, +args: [], +source: "isSend\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "selector", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@selector"]; +return $1; - return s0; - } +}, +args: [], +source: "selector\x0a\x09^ selector", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - function peg$parsekeywordPair() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "selector:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@selector"]=aString; +return self; - var key = peg$currPos * 60 + 27, - cached = peg$cache[key]; +}, +args: ["aString"], +source: "selector: aString\x0a\x09selector := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSend); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parsekeyword(); - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parsebinarySend(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c82(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRSequence_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self", +referencedClasses: [], +messageSends: ["visitIRSequence:"] +}), +$globals.IRSequence); - return s0; - } +$core.addMethod( +$core.method({ +selector: "isSequence", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - function peg$parsebinarySelector() { - var s0, s1, s2; +}, +args: [], +source: "isSequence\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSequence); - var key = peg$currPos * 60 + 28, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = []; - if (peg$c83.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c83.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } - } - } - } else { - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c85(s1); - } - s0 = s1; +$core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRBlockSequence_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self", +referencedClasses: [], +messageSends: ["visitIRBlockSequence:"] +}), +$globals.IRBlockSequence); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsekeywordPattern() { - var s0, s1, s2, s3, s4, s5, s6; +$core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR'); +$globals.IRValue.comment="I am the simplest possible instruction. I represent a value."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRValue_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self", +referencedClasses: [], +messageSends: ["visitIRValue:"] +}), +$globals.IRValue); - var key = peg$currPos * 60 + 29, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "needsBoxingAsReceiver", +protocol: 'testing', +fn: function (){ +var self=this; +return false; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "needsBoxingAsReceiver\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.IRValue); - s0 = peg$currPos; - s1 = []; - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parsekeyword(); - if (s4 !== peg$FAILED) { - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - s6 = peg$parseidentifier(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c82(s4, s6); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parsekeyword(); - if (s4 !== peg$FAILED) { - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - s6 = peg$parseidentifier(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c82(s4, s6); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } - } else { - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c86(s1); - } - s0 = s1; +$core.addMethod( +$core.method({ +selector: "value", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@value"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "value\x0a\x09^ value", +referencedClasses: [], +messageSends: [] +}), +$globals.IRValue); - return s0; - } +$core.addMethod( +$core.method({ +selector: "value:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@value"]=aString; +return self; - function peg$parsebinaryPattern() { - var s0, s1, s2, s3, s4; +}, +args: ["aString"], +source: "value: aString\x0a\x09value := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRValue); - var key = peg$currPos * 60 + 30, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parsebinarySelector(); - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseidentifier(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c87(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR'); +$globals.IRVariable.comment="I am a variable instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRVariable_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self", +referencedClasses: [], +messageSends: ["visitIRVariable:"] +}), +$globals.IRVariable); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isVariable", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - return s0; - } +}, +args: [], +source: "isVariable\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRVariable); - function peg$parseunaryPattern() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "needsBoxingAsReceiver", +protocol: 'testing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($recv(self._variable())._isPseudoVar())._not(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)}); +}, +args: [], +source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not", +referencedClasses: [], +messageSends: ["not", "isPseudoVar", "variable"] +}), +$globals.IRVariable); - var key = peg$currPos * 60 + 31, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "variable", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@variable"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "variable\x0a\x09^ variable", +referencedClasses: [], +messageSends: [] +}), +$globals.IRVariable); - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parseidentifier(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c88(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "variable:", +protocol: 'accessing', +fn: function (aScopeVariable){ +var self=this; +self["@variable"]=aScopeVariable; +return self; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: ["aScopeVariable"], +source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable", +referencedClasses: [], +messageSends: [] +}), +$globals.IRVariable); - return s0; - } - function peg$parseexpression() { - var s0; - var key = peg$currPos * 60 + 32, - cached = peg$cache[key]; +$core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRVerbatim_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self", +referencedClasses: [], +messageSends: ["visitIRVerbatim:"] +}), +$globals.IRVerbatim); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "source", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@source"]; +return $1; - s0 = peg$parseassignment(); - if (s0 === peg$FAILED) { - s0 = peg$parsecascade(); - if (s0 === peg$FAILED) { - s0 = peg$parsekeywordSend(); - if (s0 === peg$FAILED) { - s0 = peg$parsebinarySend(); - } - } - } +}, +args: [], +source: "source\x0a\x09^ source", +referencedClasses: [], +messageSends: [] +}), +$globals.IRVerbatim); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "source:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@source"]=aString; +return self; - return s0; - } +}, +args: ["aString"], +source: "source: aString\x0a\x09source := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.IRVerbatim); - function peg$parseexpressionList() { - var s0, s1, s2, s3, s4; - var key = peg$currPos * 60 + 33, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "visit:", +protocol: 'visiting', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(anIRInstruction)._accept_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)}); +}, +args: ["anIRInstruction"], +source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self", +referencedClasses: [], +messageSends: ["accept:"] +}), +$globals.IRVisitor); - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c51; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseexpression(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c89(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRAssignment:", +protocol: 'visiting', +fn: function (anIRAssignment){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRAssignment); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)}); +}, +args: ["anIRAssignment"], +source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRBlockReturn:", +protocol: 'visiting', +fn: function (anIRBlockReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRReturn_(anIRBlockReturn); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)}); +}, +args: ["anIRBlockReturn"], +source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn", +referencedClasses: [], +messageSends: ["visitIRReturn:"] +}), +$globals.IRVisitor); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRBlockSequence:", +protocol: 'visiting', +fn: function (anIRBlockSequence){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRSequence_(anIRBlockSequence); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)}); +}, +args: ["anIRBlockSequence"], +source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence", +referencedClasses: [], +messageSends: ["visitIRSequence:"] +}), +$globals.IRVisitor); - function peg$parseexpressions() { - var s0, s1, s2, s3; +$core.addMethod( +$core.method({ +selector: "visitIRClosure:", +protocol: 'visiting', +fn: function (anIRClosure){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRClosure); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)}); +}, +args: ["anIRClosure"], +source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - var key = peg$currPos * 60 + 34, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRDynamicArray:", +protocol: 'visiting', +fn: function (anIRDynamicArray){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRDynamicArray); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)}); +}, +args: ["anIRDynamicArray"], +source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRDynamicDictionary:", +protocol: 'visiting', +fn: function (anIRDynamicDictionary){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRDynamicDictionary); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)}); +}, +args: ["anIRDynamicDictionary"], +source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - s0 = peg$currPos; - s1 = peg$parseexpression(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseexpressionList(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseexpressionList(); - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c90(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedClosure:", +protocol: 'visiting', +fn: function (anIRInlinedClosure){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRClosure_(anIRInlinedClosure); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)}); +}, +args: ["anIRInlinedClosure"], +source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure", +referencedClasses: [], +messageSends: ["visitIRClosure:"] +}), +$globals.IRVisitor); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRInlinedSequence:", +protocol: 'visiting', +fn: function (anIRInlinedSequence){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRSequence_(anIRInlinedSequence); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)}); +}, +args: ["anIRInlinedSequence"], +source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence", +referencedClasses: [], +messageSends: ["visitIRSequence:"] +}), +$globals.IRVisitor); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRInstruction:", +protocol: 'visiting', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +$recv($recv(anIRInstruction)._instructions())._do_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return anIRInstruction; +}, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)}); +}, +args: ["anIRInstruction"], +source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction", +referencedClasses: [], +messageSends: ["do:", "instructions", "visit:"] +}), +$globals.IRVisitor); - function peg$parseassignment() { - var s0, s1, s2, s3, s4, s5; +$core.addMethod( +$core.method({ +selector: "visitIRMethod:", +protocol: 'visiting', +fn: function (anIRMethod){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRMethod); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)}); +}, +args: ["anIRMethod"], +source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - var key = peg$currPos * 60 + 35, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRNonLocalReturn:", +protocol: 'visiting', +fn: function (anIRNonLocalReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRNonLocalReturn); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)}); +}, +args: ["anIRNonLocalReturn"], +source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRNonLocalReturnHandling:", +protocol: 'visiting', +fn: function (anIRNonLocalReturnHandling){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRNonLocalReturnHandling); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)}); +}, +args: ["anIRNonLocalReturnHandling"], +source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - s0 = peg$currPos; - s1 = peg$parsevariable(); - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c91) { - s3 = peg$c91; - peg$currPos += 2; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - s5 = peg$parseexpression(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c93(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRReturn:", +protocol: 'visiting', +fn: function (anIRReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRReturn); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)}); +}, +args: ["anIRReturn"], +source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRSend:", +protocol: 'visiting', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRSend); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)}); +}, +args: ["anIRSend"], +source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRSequence:", +protocol: 'visiting', +fn: function (anIRSequence){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRSequence); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)}); +}, +args: ["anIRSequence"], +source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - function peg$parseret() { - var s0, s1, s2, s3, s4, s5; +$core.addMethod( +$core.method({ +selector: "visitIRTempDeclaration:", +protocol: 'visiting', +fn: function (anIRTempDeclaration){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRTempDeclaration); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)}); +}, +args: ["anIRTempDeclaration"], +source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - var key = peg$currPos * 60 + 36, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRValue:", +protocol: 'visiting', +fn: function (anIRValue){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRValue); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)}); +}, +args: ["anIRValue"], +source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRVariable:", +protocol: 'visiting', +fn: function (anIRVariable){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRVariable); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)}); +}, +args: ["anIRVariable"], +source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 94) { - s1 = peg$c94; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseexpression(); - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s5 = peg$c51; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s5 === peg$FAILED) { - s5 = peg$c41; - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c96(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRVerbatim:", +protocol: 'visiting', +fn: function (anIRVerbatim){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._visitIRInstruction_(anIRVerbatim); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)}); +}, +args: ["anIRVerbatim"], +source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim", +referencedClasses: [], +messageSends: ["visitIRInstruction:"] +}), +$globals.IRVisitor); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsetemps() { - var s0, s1, s2, s3, s4, s5; +$core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "contents", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._stream())._contents(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)}); +}, +args: [], +source: "contents\x0a\x09^ self stream contents", +referencedClasses: [], +messageSends: ["contents", "stream"] +}), +$globals.IRJSTranslator); - var key = peg$currPos * 60 + 37, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "currentClass", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@currentClass"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "currentClass\x0a\x09^ currentClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRJSTranslator); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 124) { - s1 = peg$c97; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - s5 = peg$parseidentifier(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c99(s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c1; - } - } else { - peg$currPos = s3; - s3 = peg$c1; - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - s5 = peg$parseidentifier(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c99(s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c1; - } - } else { - peg$currPos = s3; - s3 = peg$c1; - } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 124) { - s4 = peg$c97; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c100(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "currentClass:", +protocol: 'accessing', +fn: function (aClass){ +var self=this; +self["@currentClass"]=aClass; +return self; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: ["aClass"], +source: "currentClass: aClass\x0a\x09currentClass := aClass", +referencedClasses: [], +messageSends: [] +}), +$globals.IRJSTranslator); - return s0; - } +$core.addMethod( +$core.method({ +selector: "initialize", +protocol: 'initialization', +fn: function (){ +var self=this; +function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)} +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +self["@stream"]=$recv($JSStream())._new(); +return self; +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)}); +}, +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.", +referencedClasses: ["JSStream"], +messageSends: ["initialize", "new"] +}), +$globals.IRJSTranslator); - function peg$parseblockParamList() { - var s0, s1, s2, s3, s4, s5, s6; +$core.addMethod( +$core.method({ +selector: "stream", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@stream"]; +return $1; - var key = peg$currPos * 60 + 38, - cached = peg$cache[key]; +}, +args: [], +source: "stream\x0a\x09^ stream", +referencedClasses: [], +messageSends: [] +}), +$globals.IRJSTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "stream:", +protocol: 'accessing', +fn: function (aStream){ +var self=this; +self["@stream"]=aStream; +return self; - s0 = peg$currPos; - s1 = []; - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c13; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - s6 = peg$parseidentifier(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c101(s6); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$currPos; - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c13; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - s6 = peg$parseidentifier(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s2; - s3 = peg$c101(s6); - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } else { - peg$currPos = s2; - s2 = peg$c1; - } - } - } else { - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 124) { - s3 = peg$c97; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c102(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: ["aStream"], +source: "stream: aStream\x0a\x09stream := aStream", +referencedClasses: [], +messageSends: [] +}), +$globals.IRJSTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRAssignment:", +protocol: 'visiting', +fn: function (anIRAssignment){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=$recv(anIRAssignment)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$1=$recv($2)._first(); +self._visit_($1); +$ctx1.sendIdx["visit:"]=1; +$recv(self._stream())._nextPutAssignment(); +self._visit_($recv($recv(anIRAssignment)._instructions())._last()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)}); +}, +args: ["anIRAssignment"], +source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.", +referencedClasses: [], +messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"] +}), +$globals.IRJSTranslator); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRClosure:", +protocol: 'visiting', +fn: function (anIRClosure){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutClosureWith_arguments_((function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +$recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){ +return $core.withContext(function($ctx3) { +return $recv($recv(each)._name())._asVariableName(); +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); +}))); +return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){ +return $core.withContext(function($ctx3) { +return ( +$ctx3.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure])); +$ctx3.supercall = false; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$recv(anIRClosure)._arguments()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)}); +}, +args: ["anIRClosure"], +source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments", +referencedClasses: [], +messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"] +}), +$globals.IRJSTranslator); - function peg$parsesubexpression() { - var s0, s1, s2, s3, s4, s5; +$core.addMethod( +$core.method({ +selector: "visitIRDynamicArray:", +protocol: 'visiting', +fn: function (anIRDynamicArray){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutAll_("["); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(self._stream())._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv(self["@stream"])._nextPutAll_("]"); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)}); +}, +args: ["anIRDynamicArray"], +source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'", +referencedClasses: [], +messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"] +}), +$globals.IRJSTranslator); - var key = peg$currPos * 60 + 39, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRDynamicDictionary:", +protocol: 'visiting', +fn: function (anIRDynamicDictionary){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_(["); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +return $recv($2)._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv(self._stream())._nextPutAll_("])"); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)}); +}, +args: ["anIRDynamicDictionary"], +source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: '$globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'", +referencedClasses: [], +messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"] +}), +$globals.IRJSTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRMethod:", +protocol: 'visiting', +fn: function (anIRMethod){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +return $recv($2)._nextPutFunctionWith_arguments_((function(){ +return $core.withContext(function($ctx3) { +$3=self._stream(); +$ctx3.sendIdx["stream"]=3; +$4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){ +return $core.withContext(function($ctx4) { +return $recv($recv(each)._name())._asVariableName(); +}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)}); +})); +$ctx3.sendIdx["collect:"]=1; +$recv($3)._nextPutVars_($4); +$ctx3.sendIdx["nextPutVars:"]=1; +$recv($recv(anIRMethod)._classReferences())._do_((function(each){ +return $core.withContext(function($ctx4) { +$5=self._stream(); +$ctx4.sendIdx["stream"]=4; +return $recv($5)._nextPutClassRefFunction_(each); +}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)}); +})); +$6=self._stream(); +$ctx3.sendIdx["stream"]=5; +return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){ +return $core.withContext(function($ctx4) { +$8=$recv(anIRMethod)._internalVariables(); +$ctx4.sendIdx["internalVariables"]=1; +$7=$recv($8)._notEmpty(); +if($core.assert($7)){ +$9=self._stream(); +$ctx4.sendIdx["stream"]=6; +$recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){ +return $core.withContext(function($ctx5) { +return $recv($recv(each)._variable())._alias(); +}, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)}); +}))); +}; +$10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn(); +if($core.assert($10)){ +return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){ +return $core.withContext(function($ctx5) { +return ( +$ctx5.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod])); +$ctx5.supercall = false; +$ctx5.sendIdx["visitIRMethod:"]=1; +}, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)}); +})); +} else { +return ( +$ctx4.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod])); +$ctx4.supercall = false; +}; +}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)}); +})); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}),$recv(anIRMethod)._arguments()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)}); +}, +args: ["anIRMethod"], +source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]", +referencedClasses: [], +messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"] +}), +$globals.IRJSTranslator); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c57; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseexpression(); - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c60; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c89(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRNonLocalReturn:", +protocol: 'visiting', +fn: function (anIRNonLocalReturn){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._stream())._nextPutNonLocalReturnWith_((function(){ +return $core.withContext(function($ctx2) { +return ( +$ctx2.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn])); +$ctx2.supercall = false; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)}); +}, +args: ["anIRNonLocalReturn"], +source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]", +referencedClasses: [], +messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"] +}), +$globals.IRJSTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRReturn:", +protocol: 'visiting', +fn: function (anIRReturn){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._stream())._nextPutReturnWith_((function(){ +return $core.withContext(function($ctx2) { +return ( +$ctx2.supercall = true, +$globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn])); +$ctx2.supercall = false; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)}); +}, +args: ["anIRReturn"], +source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]", +referencedClasses: [], +messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"] +}), +$globals.IRJSTranslator); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRSend:", +protocol: 'visiting', +fn: function (anIRSend){ +var self=this; +var sends; +return $core.withContext(function($ctx1) { +var $1,$2,$receiver; +sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size(); +$1=$recv(anIRSend)._classSend(); +if(($receiver = $1) == null || $receiver.isNil){ +self._visitSend_(anIRSend); +} else { +self._visitSuperSend_(anIRSend); +}; +$2=$recv($recv(sends).__gt((1)))._and_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv(anIRSend)._index()).__lt(sends); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +if($core.assert($2)){ +$recv(self._stream())._nextPutSendIndexFor_(anIRSend); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)}); +}, +args: ["anIRSend"], +source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]", +referencedClasses: [], +messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"] +}), +$globals.IRJSTranslator); - function peg$parsestatements() { - var s0, s1, s2, s3, s4, s5, s6, s7; +$core.addMethod( +$core.method({ +selector: "visitIRSequence:", +protocol: 'visiting', +fn: function (anIRSequence){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutSequenceWith_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv(anIRSequence)._instructions())._do_((function(each){ +return $core.withContext(function($ctx3) { +return $recv(self._stream())._nextPutStatementWith_(self._visit_(each)); +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)}); +}, +args: ["anIRSequence"], +source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]", +referencedClasses: [], +messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"] +}), +$globals.IRJSTranslator); - var key = peg$currPos * 60 + 40, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRTempDeclaration:", +protocol: 'visiting', +fn: function (anIRTempDeclaration){ +var self=this; +return self; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: ["anIRTempDeclaration"], +source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22", +referencedClasses: [], +messageSends: [] +}), +$globals.IRJSTranslator); - s0 = peg$currPos; - s1 = peg$parseret(); - if (s1 !== peg$FAILED) { - s2 = []; - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c103(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseexpressions(); - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = []; - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c51; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c51; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - } - } else { - s3 = peg$c1; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - s5 = peg$parseret(); - if (s5 !== peg$FAILED) { - s6 = []; - if (input.charCodeAt(peg$currPos) === 46) { - s7 = peg$c51; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - while (s7 !== peg$FAILED) { - s6.push(s7); - if (input.charCodeAt(peg$currPos) === 46) { - s7 = peg$c51; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c104(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseexpressions(); - if (s1 === peg$FAILED) { - s1 = peg$c41; - } - if (s1 !== peg$FAILED) { - s2 = []; - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c105(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsesequence() { - var s0; - - var key = peg$currPos * 60 + 41, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRValue:", +protocol: 'visiting', +fn: function (anIRValue){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)}); +}, +args: ["anIRValue"], +source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript", +referencedClasses: [], +messageSends: ["nextPutAll:", "stream", "asJavascript", "value"] +}), +$globals.IRJSTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRVariable:", +protocol: 'visiting', +fn: function (anIRVariable){ +var self=this; +return $core.withContext(function($ctx1) { +var $3,$2,$1,$4; +$3=$recv(anIRVariable)._variable(); +$ctx1.sendIdx["variable"]=1; +$2=$recv($3)._name(); +$1=$recv($2).__eq("thisContext"); +if($core.assert($1)){ +$4=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($4)._nextPutAll_("$core.getThisContext()"); +$ctx1.sendIdx["nextPutAll:"]=1; +} else { +$recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias()); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)}); +}, +args: ["anIRVariable"], +source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"] +}), +$globals.IRJSTranslator); - s0 = peg$parsejsStatement(); - if (s0 === peg$FAILED) { - s0 = peg$parsestSequence(); - } +$core.addMethod( +$core.method({ +selector: "visitIRVerbatim:", +protocol: 'visiting', +fn: function (anIRVerbatim){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutStatementWith_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)}); +}, +args: ["anIRVerbatim"], +source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]", +referencedClasses: [], +messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"] +}), +$globals.IRJSTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitReceiver:", +protocol: 'visiting', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3; +$1=$recv(anIRInstruction)._needsBoxingAsReceiver(); +if(!$core.assert($1)){ +$2=self._visit_(anIRInstruction); +$ctx1.sendIdx["visit:"]=1; +return $2; +}; +$3=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($3)._nextPutAll_("$recv("); +$ctx1.sendIdx["nextPutAll:"]=1; +self._visit_(anIRInstruction); +$recv(self._stream())._nextPutAll_(")"); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)}); +}, +args: ["anIRInstruction"], +source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'", +referencedClasses: [], +messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"] +}), +$globals.IRJSTranslator); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitSend:", +protocol: 'visiting', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1,$3,$4,$5; +$2=$recv(anIRSend)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$1=$recv($2)._first(); +self._visitReceiver_($1); +$3=self._stream(); +$ctx1.sendIdx["stream"]=1; +$4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("("); +$ctx1.sendIdx[","]=1; +$recv($3)._nextPutAll_($4); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +$5=self._stream(); +$ctx2.sendIdx["stream"]=2; +return $recv($5)._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$recv(self._stream())._nextPutAll_(")"); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)}); +}, +args: ["anIRSend"], +source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'", +referencedClasses: [], +messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"] +}), +$globals.IRJSTranslator); - function peg$parsestSequence() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "visitSuperSend:", +protocol: 'visiting', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutAll_("("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=2; +$2=$1; +$5=$recv(anIRSend)._scope(); +$ctx1.sendIdx["scope"]=1; +$4=$recv($5)._alias(); +$ctx1.sendIdx["alias"]=1; +$3=$recv($4).__comma(".supercall = true, "); +$ctx1.sendIdx[","]=1; +$recv($2)._nextPutAll_($3); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=3; +$recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=4; +$recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=5; +$recv($1)._nextPutAll_(".superclass.fn.prototype."); +$ctx1.sendIdx["nextPutAll:"]=6; +$6=$1; +$7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply("); +$ctx1.sendIdx[","]=2; +$recv($6)._nextPutAll_($7); +$ctx1.sendIdx["nextPutAll:"]=7; +$8=$recv($1)._nextPutAll_("$recv("); +$ctx1.sendIdx["nextPutAll:"]=8; +$10=$recv(anIRSend)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$9=$recv($10)._first(); +self._visit_($9); +$ctx1.sendIdx["visit:"]=1; +$11=self._stream(); +$ctx1.sendIdx["stream"]=2; +$recv($11)._nextPutAll_("), ["); +$ctx1.sendIdx["nextPutAll:"]=9; +$recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +$12=self._stream(); +$ctx2.sendIdx["stream"]=3; +return $recv($12)._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=10; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$13=self._stream(); +$recv($13)._nextPutAll_("]));"); +$ctx1.sendIdx["nextPutAll:"]=11; +$recv($13)._lf(); +$ctx1.sendIdx["lf"]=5; +$recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=12; +$recv($13)._lf(); +$ctx1.sendIdx["lf"]=6; +$recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;")); +$ctx1.sendIdx["nextPutAll:"]=13; +$recv($13)._lf(); +$14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)}); +}, +args: ["anIRSend"], +source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +referencedClasses: [], +messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"] +}), +$globals.IRJSTranslator); - var key = peg$currPos * 60 + 42, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parsetemps(); - if (s1 === peg$FAILED) { - s1 = peg$c41; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parsestatements(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c106(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR'); +$core.addMethod( +$core.method({ +selector: "contents", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self["@stream"])._contents(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)}); +}, +args: [], +source: "contents\x0a\x09^ stream contents", +referencedClasses: [], +messageSends: ["contents"] +}), +$globals.JSStream); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "initialize", +protocol: 'initialization', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +self["@stream"]=""._writeStream(); +return self; +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)}); +}, +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.", +referencedClasses: [], +messageSends: ["initialize", "writeStream"] +}), +$globals.JSStream); - return s0; - } +$core.addMethod( +$core.method({ +selector: "lf", +protocol: 'streaming', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)}); +}, +args: [], +source: "lf\x0a\x09stream lf", +referencedClasses: [], +messageSends: ["lf"] +}), +$globals.JSStream); - function peg$parseblock() { - var s0, s1, s2, s3, s4, s5, s6; +$core.addMethod( +$core.method({ +selector: "nextPut:", +protocol: 'streaming', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._nextPut_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)}); +}, +args: ["aString"], +source: "nextPut: aString\x0a\x09stream nextPut: aString", +referencedClasses: [], +messageSends: ["nextPut:"] +}), +$globals.JSStream); - var key = peg$currPos * 60 + 43, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "nextPutAll:", +protocol: 'streaming', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._nextPutAll_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)}); +}, +args: ["aString"], +source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString", +referencedClasses: [], +messageSends: ["nextPutAll:"] +}), +$globals.JSStream); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "nextPutAssignment", +protocol: 'streaming', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._nextPutAll_("="); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)}); +}, +args: [], +source: "nextPutAssignment\x0a\x09stream nextPutAll: '='", +referencedClasses: [], +messageSends: ["nextPutAll:"] +}), +$globals.JSStream); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c107; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseblockParamList(); - if (s2 === peg$FAILED) { - s2 = peg$c41; - } - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parsesequence(); - if (s4 === peg$FAILED) { - s4 = peg$c41; - } - if (s4 !== peg$FAILED) { - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s6 = peg$c109; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c111(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "nextPutBlockContextFor:during:", +protocol: 'streaming', +fn: function (anIRClosure,aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24; +$1=$recv(anIRClosure)._requiresSmalltalkContext(); +if(!$core.assert($1)){ +$2=$recv(aBlock)._value(); +$ctx1.sendIdx["value"]=1; +return $2; +}; +self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=1; +self._lf(); +$ctx1.sendIdx["lf"]=1; +$6=$recv(anIRClosure)._scope(); +$ctx1.sendIdx["scope"]=1; +$5=$recv($6)._alias(); +$ctx1.sendIdx["alias"]=1; +$4="return $core.withContext(function(".__comma($5); +$ctx1.sendIdx[","]=2; +$3=$recv($4).__comma(") {"); +$ctx1.sendIdx[","]=1; +self._nextPutAll_($3); +$ctx1.sendIdx["nextPutAll:"]=2; +self._lf(); +$ctx1.sendIdx["lf"]=2; +self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +$ctx1.sendIdx["nextPutAll:"]=3; +$7=self._lf(); +$ctx1.sendIdx["lf"]=3; +$recv(aBlock)._value(); +self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=4; +self._lf(); +$ctx1.sendIdx["lf"]=4; +$11=$recv(anIRClosure)._scope(); +$ctx1.sendIdx["scope"]=2; +$10=$recv($11)._alias(); +$ctx1.sendIdx["alias"]=2; +$9="}, function(".__comma($10); +$ctx1.sendIdx[","]=4; +$8=$recv($9).__comma(") {"); +$ctx1.sendIdx[","]=3; +self._nextPutAll_($8); +$ctx1.sendIdx["nextPutAll:"]=5; +$15=$recv(anIRClosure)._scope(); +$ctx1.sendIdx["scope"]=3; +$14=$recv($15)._alias(); +$ctx1.sendIdx["alias"]=3; +$13=$recv($14).__comma(".fillBlock({"); +$ctx1.sendIdx[","]=5; +$12=self._nextPutAll_($13); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +$16=$recv(each)._asVariableName(); +$ctx2.sendIdx["asVariableName"]=1; +self._nextPutAll_($16); +$ctx2.sendIdx["nextPutAll:"]=7; +self._nextPutAll_(":"); +$ctx2.sendIdx["nextPutAll:"]=8; +$17=self._nextPutAll_($recv(each)._asVariableName()); +$ctx2.sendIdx["nextPutAll:"]=9; +return $17; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=10; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +self._nextPutAll_("},"); +$ctx1.sendIdx["nextPutAll:"]=11; +$23=$recv(anIRClosure)._scope(); +$ctx1.sendIdx["scope"]=4; +$22=$recv($23)._outerScope(); +$21=$recv($22)._alias(); +$20=$recv($21).__comma(","); +$19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString()); +$ctx1.sendIdx[","]=7; +$18=$recv($19).__comma(")});"); +$ctx1.sendIdx[","]=6; +self._nextPutAll_($18); +$ctx1.sendIdx["nextPutAll:"]=12; +self._lf(); +$24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)}); +}, +args: ["anIRClosure", "aBlock"], +source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +referencedClasses: [], +messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutClassRefFunction:", +protocol: 'streaming', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$1=self["@stream"]; +$recv($1)._nextPutAll_("function $"); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($1)._nextPutAll_(aString); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv($1)._nextPutAll_("(){return $globals."); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv($1)._nextPutAll_(aString); +$ctx1.sendIdx["nextPutAll:"]=4; +$recv($1)._nextPutAll_("||(typeof "); +$ctx1.sendIdx["nextPutAll:"]=5; +$recv($1)._nextPutAll_(aString); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv($1)._nextPutAll_("==\x22undefined\x22?nil:"); +$ctx1.sendIdx["nextPutAll:"]=7; +$recv($1)._nextPutAll_(aString); +$ctx1.sendIdx["nextPutAll:"]=8; +$recv($1)._nextPutAll_(")}"); +$2=$recv($1)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)}); +}, +args: ["aString"], +source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return $globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf", +referencedClasses: [], +messageSends: ["nextPutAll:", "lf"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutClosureWith:arguments:", +protocol: 'streaming', +fn: function (aBlock,anArray){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +$recv(self["@stream"])._nextPutAll_("(function("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(anArray)._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName()); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPut_(","); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$1=self["@stream"]; +$recv($1)._nextPutAll_("){"); +$ctx1.sendIdx["nextPutAll:"]=3; +$2=$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(aBlock)._value(); +$3=self["@stream"]; +$recv($3)._lf(); +$4=$recv($3)._nextPutAll_("})"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)}); +}, +args: ["aBlock", "anArray"], +source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'", +referencedClasses: [], +messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutContextFor:during:", +protocol: 'streaming', +fn: function (aMethod,aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19; +$1=$recv(aMethod)._requiresSmalltalkContext(); +if(!$core.assert($1)){ +$2=$recv(aBlock)._value(); +$ctx1.sendIdx["value"]=1; +return $2; +}; +self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=1; +self._lf(); +$ctx1.sendIdx["lf"]=1; +$6=$recv(aMethod)._scope(); +$ctx1.sendIdx["scope"]=1; +$5=$recv($6)._alias(); +$ctx1.sendIdx["alias"]=1; +$4="return $core.withContext(function(".__comma($5); +$ctx1.sendIdx[","]=2; +$3=$recv($4).__comma(") {"); +$ctx1.sendIdx[","]=1; +self._nextPutAll_($3); +$ctx1.sendIdx["nextPutAll:"]=2; +self._lf(); +$ctx1.sendIdx["lf"]=2; +self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +$ctx1.sendIdx["nextPutAll:"]=3; +$7=self._lf(); +$ctx1.sendIdx["lf"]=3; +$recv(aBlock)._value(); +self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=4; +self._lf(); +$ctx1.sendIdx["lf"]=4; +$12=$recv(aMethod)._scope(); +$ctx1.sendIdx["scope"]=2; +$11=$recv($12)._alias(); +$ctx1.sendIdx["alias"]=2; +$10="}, function(".__comma($11); +$ctx1.sendIdx[","]=5; +$9=$recv($10).__comma(") {"); +$ctx1.sendIdx[","]=4; +$8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias()); +$ctx1.sendIdx[","]=3; +self._nextPutAll_($8); +$ctx1.sendIdx["nextPutAll:"]=5; +$16=$recv($recv(aMethod)._selector())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=1; +$15=".fill(self,".__comma($16); +$14=$recv($15).__comma(",{"); +$ctx1.sendIdx[","]=6; +$13=self._nextPutAll_($14); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv($recv(aMethod)._locals())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +$17=$recv(each)._asVariableName(); +$ctx2.sendIdx["asVariableName"]=1; +self._nextPutAll_($17); +$ctx2.sendIdx["nextPutAll:"]=7; +self._nextPutAll_(":"); +$ctx2.sendIdx["nextPutAll:"]=8; +$18=self._nextPutAll_($recv(each)._asVariableName()); +$ctx2.sendIdx["nextPutAll:"]=9; +return $18; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=10; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +self._nextPutAll_("},"); +$ctx1.sendIdx["nextPutAll:"]=11; +self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=12; +self._nextPutAll_(")});"); +$ctx1.sendIdx["nextPutAll:"]=13; +self._lf(); +$19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aMethod", "aBlock"], +source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'", +referencedClasses: [], +messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutFunctionWith:arguments:", +protocol: 'streaming', +fn: function (aBlock,anArray){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6; +$recv(self["@stream"])._nextPutAll_("fn: function("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(anArray)._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName()); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPut_(","); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$1=self["@stream"]; +$recv($1)._nextPutAll_("){"); +$ctx1.sendIdx["nextPutAll:"]=3; +$2=$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$3=self["@stream"]; +$recv($3)._nextPutAll_("var self=this;"); +$ctx1.sendIdx["nextPutAll:"]=4; +$4=$recv($3)._lf(); +$ctx1.sendIdx["lf"]=2; +$recv(aBlock)._value(); +$5=self["@stream"]; +$recv($5)._lf(); +$6=$recv($5)._nextPutAll_("}"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)}); +}, +args: ["aBlock", "anArray"], +source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'", +referencedClasses: [], +messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutIf:with:", +protocol: 'streaming', +fn: function (aBlock,anotherBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$recv(self["@stream"])._nextPutAll_("if("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aBlock)._value(); +$ctx1.sendIdx["value"]=1; +$1=self["@stream"]; +$recv($1)._nextPutAll_("){"); +$ctx1.sendIdx["nextPutAll:"]=2; +$2=$recv($1)._lf(); +$recv(anotherBlock)._value(); +$recv(self["@stream"])._nextPutAll_("}"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)}); +}, +args: ["aBlock", "anotherBlock"], +source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'", +referencedClasses: [], +messageSends: ["nextPutAll:", "value", "lf"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutIfElse:with:with:", +protocol: 'streaming', +fn: function (aBlock,ifBlock,elseBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +$recv(self["@stream"])._nextPutAll_("if("); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aBlock)._value(); +$ctx1.sendIdx["value"]=1; +$1=self["@stream"]; +$recv($1)._nextPutAll_("){"); +$ctx1.sendIdx["nextPutAll:"]=2; +$2=$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv(ifBlock)._value(); +$ctx1.sendIdx["value"]=2; +$3=self["@stream"]; +$recv($3)._nextPutAll_("} else {"); +$ctx1.sendIdx["nextPutAll:"]=3; +$4=$recv($3)._lf(); +$recv(elseBlock)._value(); +$recv(self["@stream"])._nextPutAll_("}"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)}); +}, +args: ["aBlock", "ifBlock", "elseBlock"], +source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'", +referencedClasses: [], +messageSends: ["nextPutAll:", "value", "lf"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutMethodDeclaration:with:", +protocol: 'streaming', +fn: function (aMethod,aBlock){ +var self=this; +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $core.withContext(function($ctx1) { +var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26; +$1=self["@stream"]; +$recv($1)._nextPutAll_("$core.method({"); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$2=$1; +$5=$recv($recv(aMethod)._selector())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=1; +$4="selector: ".__comma($5); +$ctx1.sendIdx[","]=2; +$3=$recv($4).__comma(","); +$ctx1.sendIdx[","]=1; +$recv($2)._nextPutAll_($3); +$ctx1.sendIdx["nextPutAll:"]=2; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=2; +$6=$1; +$9=$recv($recv(aMethod)._source())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=2; +$8="source: ".__comma($9); +$ctx1.sendIdx[","]=4; +$7=$recv($8).__comma(","); +$ctx1.sendIdx[","]=3; +$recv($6)._nextPutAll_($7); +$ctx1.sendIdx["nextPutAll:"]=3; +$10=$recv($1)._lf(); +$ctx1.sendIdx["lf"]=3; +$recv(aBlock)._value(); +$ctx1.sendIdx["value"]=1; +$11=self["@stream"]; +$12=$11; +$15=$recv($String())._lf(); +$ctx1.sendIdx["lf"]=4; +$14=",".__comma($15); +$ctx1.sendIdx[","]=6; +$13=$recv($14).__comma("messageSends: "); +$ctx1.sendIdx[","]=5; +$recv($12)._nextPutAll_($13); +$ctx1.sendIdx["nextPutAll:"]=4; +$16=$11; +$19=$recv($recv(aMethod)._messageSends())._asArray(); +$ctx1.sendIdx["asArray"]=1; +$18=$recv($19)._asJavascript(); +$ctx1.sendIdx["asJavascript"]=3; +$17=$recv($18).__comma(","); +$ctx1.sendIdx[","]=7; +$recv($16)._nextPutAll_($17); +$ctx1.sendIdx["nextPutAll:"]=5; +$recv($11)._lf(); +$ctx1.sendIdx["lf"]=5; +$20=$11; +$23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._value(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})))._asArray())._asJavascript(); +$ctx1.sendIdx["asJavascript"]=4; +$22="args: ".__comma($23); +$21=$recv($22).__comma(","); +$ctx1.sendIdx[","]=8; +$recv($20)._nextPutAll_($21); +$ctx1.sendIdx["nextPutAll:"]=6; +$recv($11)._lf(); +$24=$recv($11)._nextPutAll_("referencedClasses: ["); +$ctx1.sendIdx["nextPutAll:"]=7; +$recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript()); +$ctx2.sendIdx["nextPutAll:"]=8; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=9; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$25=self["@stream"]; +$recv($25)._nextPutAll_("]"); +$ctx1.sendIdx["nextPutAll:"]=10; +$26=$recv($25)._nextPutAll_("})"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aMethod", "aBlock"], +source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'", +referencedClasses: ["String"], +messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"] +}), +$globals.JSStream); + +$core.addMethod( +$core.method({ +selector: "nextPutNonLocalReturnHandlingWith:", +protocol: 'streaming', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4; +$1=self["@stream"]; +$recv($1)._nextPutAll_("var $early={};"); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv($1)._lf(); +$ctx1.sendIdx["lf"]=1; +$recv($1)._nextPutAll_("try {"); +$ctx1.sendIdx["nextPutAll:"]=2; +$2=$recv($1)._lf(); +$ctx1.sendIdx["lf"]=2; +$recv(aBlock)._value(); +$3=self["@stream"]; +$recv($3)._nextPutAll_("}"); +$ctx1.sendIdx["nextPutAll:"]=3; +$recv($3)._lf(); +$ctx1.sendIdx["lf"]=3; +$recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}"); +$4=$recv($3)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aBlock"], +source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf", +referencedClasses: [], +messageSends: ["nextPutAll:", "lf", "value"] +}), +$globals.JSStream); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "nextPutNonLocalReturnWith:", +protocol: 'streaming', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._nextPutAll_("throw $early=["); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aBlock)._value(); +$recv(self["@stream"])._nextPutAll_("]"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aBlock"], +source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'", +referencedClasses: [], +messageSends: ["nextPutAll:", "value"] +}), +$globals.JSStream); - return s0; - } +$core.addMethod( +$core.method({ +selector: "nextPutReturn", +protocol: 'streaming', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self["@stream"])._nextPutAll_("return "); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)}); +}, +args: [], +source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '", +referencedClasses: [], +messageSends: ["nextPutAll:"] +}), +$globals.JSStream); - function peg$parseoperand() { - var s0; +$core.addMethod( +$core.method({ +selector: "nextPutReturnWith:", +protocol: 'streaming', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +self._nextPutReturn(); +$recv(aBlock)._value(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aBlock"], +source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value", +referencedClasses: [], +messageSends: ["nextPutReturn", "value"] +}), +$globals.JSStream); - var key = peg$currPos * 60 + 44, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "nextPutSendIndexFor:", +protocol: 'streaming', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +self._nextPutAll_(";"); +$ctx1.sendIdx["nextPutAll:"]=1; +self._lf(); +$ctx1.sendIdx["lf"]=1; +self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);"); +$ctx1.sendIdx["nextPutAll:"]=2; +self._lf(); +$ctx1.sendIdx["lf"]=2; +self._nextPutAll_($recv($recv(anIRSend)._scope())._alias()); +$ctx1.sendIdx["nextPutAll:"]=3; +self._nextPutAll_(".sendIdx["); +$ctx1.sendIdx["nextPutAll:"]=4; +self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript()); +$ctx1.sendIdx["nextPutAll:"]=5; +self._nextPutAll_("]="); +$ctx1.sendIdx["nextPutAll:"]=6; +self._nextPutAll_($recv($recv(anIRSend)._index())._asString()); +$ctx1.sendIdx["nextPutAll:"]=7; +self._nextPutAll_(";"); +$ctx1.sendIdx["nextPutAll:"]=8; +self._lf(); +$1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)"); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)}); +}, +args: ["anIRSend"], +source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'", +referencedClasses: [], +messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"] +}), +$globals.JSStream); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "nextPutSequenceWith:", +protocol: 'streaming', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aBlock)._value(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aBlock"], +source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22", +referencedClasses: [], +messageSends: ["value"] +}), +$globals.JSStream); - s0 = peg$parseliteral(); - if (s0 === peg$FAILED) { - s0 = peg$parsevariable(); - if (s0 === peg$FAILED) { - s0 = peg$parsesubexpression(); - } - } +$core.addMethod( +$core.method({ +selector: "nextPutStatementWith:", +protocol: 'streaming', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$recv(aBlock)._value(); +$1=self["@stream"]; +$recv($1)._nextPutAll_(";"); +$2=$recv($1)._lf(); +return self; +}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)}); +}, +args: ["aBlock"], +source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf", +referencedClasses: [], +messageSends: ["value", "nextPutAll:", "lf"] +}), +$globals.JSStream); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "nextPutVars:", +protocol: 'streaming', +fn: function (aCollection){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +var $early={}; +try { +$recv(aCollection)._ifEmpty_((function(){ +throw $early=[self]; - return s0; - } +})); +$recv(self["@stream"])._nextPutAll_("var "); +$ctx1.sendIdx["nextPutAll:"]=1; +$recv(aCollection)._do_separatedBy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_(each); +$ctx2.sendIdx["nextPutAll:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@stream"])._nextPutAll_(","); +$ctx2.sendIdx["nextPutAll:"]=3; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$1=self["@stream"]; +$recv($1)._nextPutAll_(";"); +$2=$recv($1)._lf(); +return self; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)}); +}, +args: ["aCollection"], +source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf", +referencedClasses: [], +messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"] +}), +$globals.JSStream); - function peg$parseunaryMessage() { - var s0, s1, s2, s3, s4; - var key = peg$currPos * 60 + 45, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "appendToInstruction:", +protocol: '*Compiler-IR', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(anIRInstruction)._appendBlock_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)}); +}, +args: ["anIRInstruction"], +source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self", +referencedClasses: [], +messageSends: ["appendBlock:"] +}), +$globals.BlockClosure); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}); - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parseidentifier(); - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c13; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = peg$c112; - } else { - peg$currPos = s3; - s3 = peg$c1; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c113(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-Inlining'); +$core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"}; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining'); +$globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRInlinedAssignment_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self", +referencedClasses: [], +messageSends: ["visitIRInlinedAssignment:"] +}), +$globals.IRInlinedAssignment); - return s0; - } +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - function peg$parseunaryTail() { - var s0, s1, s2, s3, s4; +}, +args: [], +source: "isInlined\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedAssignment); - var key = peg$currPos * 60 + 46, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parseunaryMessage(); - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseunaryTail(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c114(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining'); +$globals.IRInlinedClosure.comment="I represent an inlined closure instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedClosure_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self", +referencedClasses: [], +messageSends: ["visitIRInlinedClosure:"] +}), +$globals.IRInlinedClosure); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - return s0; - } +}, +args: [], +source: "isInlined\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedClosure); - function peg$parseunarySend() { - var s0, s1, s2, s3; - var key = peg$currPos * 60 + 47, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining'); +$globals.IRInlinedReturn.comment="I represent an inlined local return instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(aVisitor)._visitIRInlinedReturn_(self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self", +referencedClasses: [], +messageSends: ["visitIRInlinedReturn:"] +}), +$globals.IRInlinedReturn); + +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return true; + +}, +args: [], +source: "isInlined\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedReturn); + + + +$core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining'); +$globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitInlinedSend_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self", +referencedClasses: [], +messageSends: ["visitInlinedSend:"] +}), +$globals.IRInlinedSend); + +$core.addMethod( +$core.method({ +selector: "internalVariables", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=[]; +return $1; + +}, +args: [], +source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedSend); + +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return true; + +}, +args: [], +source: "isInlined\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedSend); + + + +$core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining'); +$globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedIfFalse_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self", +referencedClasses: [], +messageSends: ["visitIRInlinedIfFalse:"] +}), +$globals.IRInlinedIfFalse); - s0 = peg$currPos; - s1 = peg$parseoperand(); - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parseunaryTail(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c115(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } +$core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining'); +$globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self", +referencedClasses: [], +messageSends: ["visitIRInlinedIfNilIfNotNil:"] +}), +$globals.IRInlinedIfNilIfNotNil); - function peg$parsebinaryMessage() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "internalVariables", +protocol: 'accessing', +fn: function (){ +var self=this; +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($Array())._with_(self._receiverInternalVariable()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)}); +}, +args: [], +source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable", +referencedClasses: ["Array"], +messageSends: ["with:", "receiverInternalVariable"] +}), +$globals.IRInlinedIfNilIfNotNil); - var key = peg$currPos * 60 + 48, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "receiverInternalVariable", +protocol: 'accessing', +fn: function (){ +var self=this; +function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} +function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRVariable())._new(); +$ctx1.sendIdx["new"]=1; +$recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName())); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)}); +}, +args: [], +source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.", +referencedClasses: ["IRVariable", "AliasVar"], +messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"] +}), +$globals.IRInlinedIfNilIfNotNil); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "receiverInternalVariableName", +protocol: 'accessing', +fn: function (){ +var self=this; +return "$receiver"; - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parsebinarySelector(); - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseunarySend(); - if (s4 === peg$FAILED) { - s4 = peg$parseoperand(); - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c116(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: [], +source: "receiverInternalVariableName\x0a\x09^ '$receiver'", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedIfNilIfNotNil); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsebinaryTail() { - var s0, s1, s2; +$core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining'); +$globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedIfTrue_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self", +referencedClasses: [], +messageSends: ["visitIRInlinedIfTrue:"] +}), +$globals.IRInlinedIfTrue); - var key = peg$currPos * 60 + 49, - cached = peg$cache[key]; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parsebinaryMessage(); - if (s1 !== peg$FAILED) { - s2 = peg$parsebinaryTail(); - if (s2 === peg$FAILED) { - s2 = peg$c41; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c117(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining'); +$globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self", +referencedClasses: [], +messageSends: ["visitIRInlinedIfTrueIfFalse:"] +}), +$globals.IRInlinedIfTrueIfFalse); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsebinarySend() { - var s0, s1, s2; +$core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining'); +$globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."; +$core.addMethod( +$core.method({ +selector: "accept:", +protocol: 'visiting', +fn: function (aVisitor){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(aVisitor)._visitIRInlinedSequence_(self); +return self; +}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)}); +}, +args: ["aVisitor"], +source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self", +referencedClasses: [], +messageSends: ["visitIRInlinedSequence:"] +}), +$globals.IRInlinedSequence); - var key = peg$currPos * 60 + 50, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "isInlined", +protocol: 'testing', +fn: function (){ +var self=this; +return true; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "isInlined\x0a\x09^ true", +referencedClasses: [], +messageSends: [] +}), +$globals.IRInlinedSequence); - s0 = peg$currPos; - s1 = peg$parseunarySend(); - if (s1 !== peg$FAILED) { - s2 = peg$parsebinaryTail(); - if (s2 === peg$FAILED) { - s2 = peg$c41; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c115(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } +$core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining'); +$globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`"; +$core.addMethod( +$core.method({ +selector: "assignmentInliner", +protocol: 'factory', +fn: function (){ +var self=this; +function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRAssignmentInliner())._new(); +$recv($2)._translator_(self); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)}); +}, +args: [], +source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", +referencedClasses: ["IRAssignmentInliner"], +messageSends: ["translator:", "new", "yourself"] +}), +$globals.IRInliner); - function peg$parsekeywordMessage() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "returnInliner", +protocol: 'factory', +fn: function (){ +var self=this; +function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRReturnInliner())._new(); +$recv($2)._translator_(self); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)}); +}, +args: [], +source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", +referencedClasses: ["IRReturnInliner"], +messageSends: ["translator:", "new", "yourself"] +}), +$globals.IRInliner); - var key = peg$currPos * 60 + 51, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "sendInliner", +protocol: 'factory', +fn: function (){ +var self=this; +function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($IRSendInliner())._new(); +$recv($2)._translator_(self); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)}); +}, +args: [], +source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", +referencedClasses: ["IRSendInliner"], +messageSends: ["translator:", "new", "yourself"] +}), +$globals.IRInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "shouldInlineAssignment:", +protocol: 'testing', +fn: function (anIRAssignment){ +var self=this; +return $core.withContext(function($ctx1) { +var $4,$3,$2,$1; +$1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){ +return $core.withContext(function($ctx2) { +$4=$recv(anIRAssignment)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$3=$recv($4)._last(); +$ctx2.sendIdx["last"]=1; +$2=$recv($3)._isSend(); +return $recv($2)._and_((function(){ +return $core.withContext(function($ctx3) { +return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last()); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$ctx1.sendIdx["and:"]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)}); +}, +args: ["anIRAssignment"], +source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]", +referencedClasses: [], +messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"] +}), +$globals.IRInliner); - s0 = peg$currPos; - s1 = []; - s2 = peg$parsekeywordPair(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsekeywordPair(); - } - } else { - s1 = peg$c1; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c118(s1); - } - s0 = s1; +$core.addMethod( +$core.method({ +selector: "shouldInlineReturn:", +protocol: 'testing', +fn: function (anIRReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $4,$3,$2,$1; +$1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){ +return $core.withContext(function($ctx2) { +$4=$recv(anIRReturn)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$3=$recv($4)._first(); +$ctx2.sendIdx["first"]=1; +$2=$recv($3)._isSend(); +return $recv($2)._and_((function(){ +return $core.withContext(function($ctx3) { +return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first()); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$ctx1.sendIdx["and:"]=1; +return $1; +}, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)}); +}, +args: ["anIRReturn"], +source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]", +referencedClasses: [], +messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"] +}), +$globals.IRInliner); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "shouldInlineSend:", +protocol: 'testing', +fn: function (anIRSend){ +var self=this; +function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){ +return $core.withContext(function($ctx2) { +return $recv($IRSendInliner())._shouldInline_(anIRSend); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)}); +}, +args: ["anIRSend"], +source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]", +referencedClasses: ["IRSendInliner"], +messageSends: ["and:", "not", "isInlined", "shouldInline:"] +}), +$globals.IRInliner); - return s0; - } +$core.addMethod( +$core.method({ +selector: "transformNonLocalReturn:", +protocol: 'visiting', +fn: function (anIRNonLocalReturn){ +var self=this; +var localReturn; +function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} +return $core.withContext(function($ctx1) { +var $2,$1,$4,$3,$5,$6,$7,$8,$9; +$2=$recv(anIRNonLocalReturn)._scope(); +$ctx1.sendIdx["scope"]=1; +$1=$recv($2)._canInlineNonLocalReturns(); +if($core.assert($1)){ +$4=$recv(anIRNonLocalReturn)._scope(); +$ctx1.sendIdx["scope"]=2; +$3=$recv($4)._methodScope(); +$5=$recv(anIRNonLocalReturn)._scope(); +$ctx1.sendIdx["scope"]=3; +$recv($3)._removeNonLocalReturn_($5); +$6=$recv($IRReturn())._new(); +$recv($6)._scope_($recv(anIRNonLocalReturn)._scope()); +$7=$recv($6)._yourself(); +localReturn=$7; +localReturn; +$recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(localReturn)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$recv(anIRNonLocalReturn)._replaceWith_(localReturn); +$8=localReturn; +return $8; +}; +$9=( +$ctx1.supercall = true, +$globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn])); +$ctx1.supercall = false; +return $9; +}, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)}); +}, +args: ["anIRNonLocalReturn"], +source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn", +referencedClasses: ["IRReturn"], +messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"] +}), +$globals.IRInliner); - function peg$parsekeywordSend() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "visitIRAssignment:", +protocol: 'visiting', +fn: function (anIRAssignment){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._shouldInlineAssignment_(anIRAssignment); +if($core.assert($2)){ +$1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment); +} else { +$1=( +$ctx1.supercall = true, +$globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment])); +$ctx1.supercall = false; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)}); +}, +args: ["anIRAssignment"], +source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"] +}), +$globals.IRInliner); - var key = peg$currPos * 60 + 52, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRNonLocalReturn:", +protocol: 'visiting', +fn: function (anIRNonLocalReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._transformNonLocalReturn_(anIRNonLocalReturn); +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)}); +}, +args: ["anIRNonLocalReturn"], +source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn", +referencedClasses: [], +messageSends: ["transformNonLocalReturn:"] +}), +$globals.IRInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRReturn:", +protocol: 'visiting', +fn: function (anIRReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._shouldInlineReturn_(anIRReturn); +if($core.assert($2)){ +$1=$recv(self._returnInliner())._inlineReturn_(anIRReturn); +} else { +$1=( +$ctx1.supercall = true, +$globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn])); +$ctx1.supercall = false; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)}); +}, +args: ["anIRReturn"], +source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"] +}), +$globals.IRInliner); - s0 = peg$currPos; - s1 = peg$parsebinarySend(); - if (s1 !== peg$FAILED) { - s2 = peg$parsekeywordMessage(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c119(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRSend:", +protocol: 'visiting', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$1; +$2=self._shouldInlineSend_(anIRSend); +if($core.assert($2)){ +$1=$recv(self._sendInliner())._inlineSend_(anIRSend); +} else { +$1=( +$ctx1.supercall = true, +$globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend])); +$ctx1.supercall = false; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)}); +}, +args: ["anIRSend"], +source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"] +}), +$globals.IRInliner); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsemessage() { - var s0; +$core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining'); +$globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."; +$core.addMethod( +$core.method({ +selector: "visitIRInlinedAssignment:", +protocol: 'visiting', +fn: function (anIRInlinedAssignment){ +var self=this; +return $core.withContext(function($ctx1) { +self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedAssignment"], +source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last", +referencedClasses: [], +messageSends: ["visit:", "last", "instructions"] +}), +$globals.IRInliningJSTranslator); - var key = peg$currPos * 60 + 53, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "visitIRInlinedClosure:", +protocol: 'visiting', +fn: function (anIRInlinedClosure){ +var self=this; +return $core.withContext(function($ctx1) { +$recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv($recv(each)._name())._asVariableName(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +}))); +$recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){ +return $core.withContext(function($ctx2) { +return self._visit_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedClosure"], +source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]", +referencedClasses: [], +messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"] +}), +$globals.IRInliningJSTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedIfFalse:", +protocol: 'visiting', +fn: function (anIRInlinedIfFalse){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$4,$3; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutIf_with_((function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +$recv($2)._nextPutAll_("!$core.assert("); +$ctx2.sendIdx["nextPutAll:"]=1; +$4=$recv(anIRInlinedIfFalse)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$3=$recv($4)._first(); +self._visit_($3); +$ctx2.sendIdx["visit:"]=1; +return $recv(self._stream())._nextPutAll_(")"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedIfFalse"], +source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]", +referencedClasses: [], +messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"] +}), +$globals.IRInliningJSTranslator); - s0 = peg$parsebinaryMessage(); - if (s0 === peg$FAILED) { - s0 = peg$parseunaryMessage(); - if (s0 === peg$FAILED) { - s0 = peg$parsekeywordMessage(); - } - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedIfNilIfNotNil:", +protocol: 'visiting', +fn: function (anIRInlinedIfNilIfNotNil){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$4,$7,$6; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutIfElse_with_with_((function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +$3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = "); +$ctx2.sendIdx[","]=1; +$recv($2)._nextPutAll_($3); +$ctx2.sendIdx["nextPutAll:"]=1; +$5=$recv(anIRInlinedIfNilIfNotNil)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$4=$recv($5)._first(); +self._visit_($4); +$ctx2.sendIdx["visit:"]=1; +return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +$7=$recv(anIRInlinedIfNilIfNotNil)._instructions(); +$ctx2.sendIdx["instructions"]=2; +$6=$recv($7)._second(); +return self._visit_($6); +$ctx2.sendIdx["visit:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedIfNilIfNotNil"], +source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]", +referencedClasses: [], +messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"] +}), +$globals.IRInliningJSTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "visitIRInlinedIfTrue:", +protocol: 'visiting', +fn: function (anIRInlinedIfTrue){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$4,$3; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutIf_with_((function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +$recv($2)._nextPutAll_("$core.assert("); +$ctx2.sendIdx["nextPutAll:"]=1; +$4=$recv(anIRInlinedIfTrue)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$3=$recv($4)._first(); +self._visit_($3); +$ctx2.sendIdx["visit:"]=1; +return $recv(self._stream())._nextPutAll_(")"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedIfTrue"], +source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]", +referencedClasses: [], +messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"] +}), +$globals.IRInliningJSTranslator); - return s0; - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedIfTrueIfFalse:", +protocol: 'visiting', +fn: function (anIRInlinedIfTrueIfFalse){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2,$4,$3,$6,$5; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutIfElse_with_with_((function(){ +return $core.withContext(function($ctx2) { +$2=self._stream(); +$ctx2.sendIdx["stream"]=2; +$recv($2)._nextPutAll_("$core.assert("); +$ctx2.sendIdx["nextPutAll:"]=1; +$4=$recv(anIRInlinedIfTrueIfFalse)._instructions(); +$ctx2.sendIdx["instructions"]=1; +$3=$recv($4)._first(); +self._visit_($3); +$ctx2.sendIdx["visit:"]=1; +return $recv(self._stream())._nextPutAll_(")"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),(function(){ +return $core.withContext(function($ctx2) { +$6=$recv(anIRInlinedIfTrueIfFalse)._instructions(); +$ctx2.sendIdx["instructions"]=2; +$5=$recv($6)._second(); +return self._visit_($5); +$ctx2.sendIdx["visit:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),(function(){ +return $core.withContext(function($ctx2) { +return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedIfTrueIfFalse"], +source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]", +referencedClasses: [], +messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"] +}), +$globals.IRInliningJSTranslator); - function peg$parsecascade() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8; +$core.addMethod( +$core.method({ +selector: "visitIRInlinedNonLocalReturn:", +protocol: 'visiting', +fn: function (anIRInlinedReturn){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._stream(); +$ctx1.sendIdx["stream"]=1; +$recv($1)._nextPutStatementWith_((function(){ +return $core.withContext(function($ctx2) { +return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$recv(self._stream())._nextPutNonLocalReturnWith_((function(){ - var key = peg$currPos * 60 + 54, - cached = peg$cache[key]; +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedReturn"], +source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]", +referencedClasses: [], +messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"] +}), +$globals.IRInliningJSTranslator); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedReturn:", +protocol: 'visiting', +fn: function (anIRInlinedReturn){ +var self=this; +return $core.withContext(function($ctx1) { +self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedReturn"], +source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last", +referencedClasses: [], +messageSends: ["visit:", "last", "instructions"] +}), +$globals.IRInliningJSTranslator); - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - s2 = peg$parsekeywordSend(); - if (s2 === peg$FAILED) { - s2 = peg$parsebinarySend(); - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$currPos; - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s6 = peg$c120; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c121); } - } - if (s6 !== peg$FAILED) { - s7 = peg$parsews(); - if (s7 !== peg$FAILED) { - s8 = peg$parsemessage(); - if (s8 !== peg$FAILED) { - peg$reportedPos = s4; - s5 = peg$c122(s8); - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$currPos; - s5 = peg$parsews(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s6 = peg$c120; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c121); } - } - if (s6 !== peg$FAILED) { - s7 = peg$parsews(); - if (s7 !== peg$FAILED) { - s8 = peg$parsemessage(); - if (s8 !== peg$FAILED) { - peg$reportedPos = s4; - s5 = peg$c122(s8); - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } else { - peg$currPos = s4; - s4 = peg$c1; - } - } - } else { - s3 = peg$c1; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c123(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "visitIRInlinedSequence:", +protocol: 'visiting', +fn: function (anIRInlinedSequence){ +var self=this; +return $core.withContext(function($ctx1) { +$recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(self._stream())._nextPutStatementWith_((function(){ +return $core.withContext(function($ctx3) { +return self._visit_(each); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)}); +}, +args: ["anIRInlinedSequence"], +source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]", +referencedClasses: [], +messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"] +}), +$globals.IRInliningJSTranslator); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - return s0; - } - function peg$parsejsStatement() { - var s0, s1, s2, s3, s4; +$core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining'); +$globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."; +$core.addMethod( +$core.method({ +selector: "ifFalse:", +protocol: 'inlining', +fn: function (anIRInstruction){ +var self=this; +function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction"], +source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction", +referencedClasses: ["IRInlinedIfFalse"], +messageSends: ["inlinedSend:with:", "new"] +}), +$globals.IRSendInliner); - var key = peg$currPos * 60 + 55, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "ifFalse:ifTrue:", +protocol: 'inlining', +fn: function (anIRInstruction,anotherIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction", "anotherIRInstruction"], +source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }", +referencedClasses: [], +messageSends: ["perform:withArguments:"] +}), +$globals.IRSendInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "ifNil:", +protocol: 'inlining', +fn: function (anIRInstruction){ +var self=this; +function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} +function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} +function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} +return $core.withContext(function($ctx1) { +var $2,$4,$5,$7,$8,$6,$9,$3,$1; +$2=$recv($IRInlinedIfNilIfNotNil())._new(); +$ctx1.sendIdx["new"]=1; +$4=$recv($IRClosure())._new(); +$ctx1.sendIdx["new"]=2; +$recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy()); +$5=$4; +$7=$recv($IRBlockSequence())._new(); +$recv($7)._add_($recv($recv(self._send())._instructions())._first()); +$8=$recv($7)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$6=$8; +$recv($5)._add_($6); +$ctx1.sendIdx["add:"]=1; +$9=$recv($4)._yourself(); +$3=$9; +$1=self._inlinedSend_with_with_($2,anIRInstruction,$3); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction"], +source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)", +referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"], +messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"] +}), +$globals.IRSendInliner); - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c124; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c126) { - s4 = peg$c126; - peg$currPos += 2; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c128(); - } - s3 = s4; - if (s3 === peg$FAILED) { - if (peg$c129.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } - } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c126) { - s4 = peg$c126; - peg$currPos += 2; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s3; - s4 = peg$c128(); - } - s3 = s4; - if (s3 === peg$FAILED) { - if (peg$c129.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } - } - } - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 62) { - s3 = peg$c131; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c132); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c133(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "ifNil:ifNotNil:", +protocol: 'inlining', +fn: function (anIRInstruction,anotherIRInstruction){ +var self=this; +function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction", "anotherIRInstruction"], +source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction", +referencedClasses: ["IRInlinedIfNilIfNotNil"], +messageSends: ["inlinedSend:with:with:", "new"] +}), +$globals.IRSendInliner); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "ifNotNil:", +protocol: 'inlining', +fn: function (anIRInstruction){ +var self=this; +function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} +function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)} +function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)} +return $core.withContext(function($ctx1) { +var $2,$4,$5,$7,$8,$6,$9,$3,$1; +$2=$recv($IRInlinedIfNilIfNotNil())._new(); +$ctx1.sendIdx["new"]=1; +$4=$recv($IRClosure())._new(); +$ctx1.sendIdx["new"]=2; +$recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy()); +$5=$4; +$7=$recv($IRBlockSequence())._new(); +$recv($7)._add_($recv($recv(self._send())._instructions())._first()); +$8=$recv($7)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$6=$8; +$recv($5)._add_($6); +$ctx1.sendIdx["add:"]=1; +$9=$recv($4)._yourself(); +$3=$9; +$1=self._inlinedSend_with_with_($2,$3,anIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction"], +source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction", +referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"], +messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"] +}), +$globals.IRSendInliner); - return s0; - } +$core.addMethod( +$core.method({ +selector: "ifNotNil:ifNil:", +protocol: 'inlining', +fn: function (anIRInstruction,anotherIRInstruction){ +var self=this; +function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction", "anotherIRInstruction"], +source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction", +referencedClasses: ["IRInlinedIfNilIfNotNil"], +messageSends: ["inlinedSend:with:with:", "new"] +}), +$globals.IRSendInliner); - function peg$parsemethod() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "ifTrue:", +protocol: 'inlining', +fn: function (anIRInstruction){ +var self=this; +function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction"], +source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction", +referencedClasses: ["IRInlinedIfTrue"], +messageSends: ["inlinedSend:with:", "new"] +}), +$globals.IRSendInliner); - var key = peg$currPos * 60 + 56, - cached = peg$cache[key]; +$core.addMethod( +$core.method({ +selector: "ifTrue:ifFalse:", +protocol: 'inlining', +fn: function (anIRInstruction,anotherIRInstruction){ +var self=this; +function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)} +return $core.withContext(function($ctx1) { +var $1; +$1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction); +return $1; +}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)}); +}, +args: ["anIRInstruction", "anotherIRInstruction"], +source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction", +referencedClasses: ["IRInlinedIfTrueIfFalse"], +messageSends: ["inlinedSend:with:with:", "new"] +}), +$globals.IRSendInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "inlineClosure:", +protocol: 'inlining', +fn: function (anIRClosure){ +var self=this; +var inlinedClosure,sequence,statements; +function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)} +function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} +function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)} +function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37; +inlinedClosure=self._inlinedClosure(); +$1=inlinedClosure; +$2=$1; +$3=$recv(anIRClosure)._scope(); +$ctx1.sendIdx["scope"]=1; +$recv($2)._scope_($3); +$ctx1.sendIdx["scope:"]=1; +$4=$recv($1)._parent_($recv(anIRClosure)._parent()); +$recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(inlinedClosure)._add_(each); +$ctx2.sendIdx["add:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +sequence=self._inlinedSequence(); +$recv($recv(anIRClosure)._arguments())._do_((function(each){ +return $core.withContext(function($ctx2) { +$5=inlinedClosure; +$7=$recv($IRTempDeclaration())._new(); +$ctx2.sendIdx["new"]=1; +$recv($7)._name_(each); +$ctx2.sendIdx["name:"]=1; +$8=$recv($7)._yourself(); +$ctx2.sendIdx["yourself"]=1; +$6=$8; +$recv($5)._add_($6); +$ctx2.sendIdx["add:"]=2; +$9=sequence; +$11=$recv($IRAssignment())._new(); +$ctx2.sendIdx["new"]=2; +$12=$11; +$14=$recv($IRVariable())._new(); +$ctx2.sendIdx["new"]=3; +$16=$recv($AliasVar())._new(); +$ctx2.sendIdx["new"]=4; +$17=$16; +$18=$recv(inlinedClosure)._scope(); +$ctx2.sendIdx["scope"]=2; +$recv($17)._scope_($18); +$ctx2.sendIdx["scope:"]=2; +$recv($16)._name_(each); +$ctx2.sendIdx["name:"]=2; +$19=$recv($16)._yourself(); +$ctx2.sendIdx["yourself"]=2; +$15=$19; +$13=$recv($14)._variable_($15); +$ctx2.sendIdx["variable:"]=1; +$recv($12)._add_($13); +$ctx2.sendIdx["add:"]=4; +$20=$11; +$22=$recv($IRVariable())._new(); +$ctx2.sendIdx["new"]=5; +$24=$recv($AliasVar())._new(); +$recv($24)._scope_($recv(inlinedClosure)._scope()); +$recv($24)._name_("$receiver"); +$25=$recv($24)._yourself(); +$ctx2.sendIdx["yourself"]=3; +$23=$25; +$21=$recv($22)._variable_($23); +$recv($20)._add_($21); +$ctx2.sendIdx["add:"]=5; +$26=$recv($11)._yourself(); +$10=$26; +return $recv($9)._add_($10); +$ctx2.sendIdx["add:"]=3; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +$ctx1.sendIdx["do:"]=2; +$recv(inlinedClosure)._add_(sequence); +$ctx1.sendIdx["add:"]=6; +$28=$recv(anIRClosure)._instructions(); +$ctx1.sendIdx["instructions"]=2; +$27=$recv($28)._last(); +$ctx1.sendIdx["last"]=1; +statements=$recv($27)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv(statements)._ifNotEmpty_((function(){ +return $core.withContext(function($ctx2) { +$recv($recv(statements)._allButLast())._do_((function(each){ +return $core.withContext(function($ctx3) { +return $recv(sequence)._add_(each); +$ctx3.sendIdx["add:"]=7; +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)}); +})); +$31=$recv(statements)._last(); +$ctx2.sendIdx["last"]=2; +$30=$recv($31)._isReturn(); +$29=$recv($30)._and_((function(){ +return $core.withContext(function($ctx3) { +$32=$recv(statements)._last(); +$ctx3.sendIdx["last"]=3; +return $recv($32)._isBlockReturn(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)}); +})); +if($core.assert($29)){ +$33=sequence; +$36=$recv(statements)._last(); +$ctx2.sendIdx["last"]=4; +$35=$recv($36)._instructions(); +$34=$recv($35)._first(); +return $recv($33)._add_($34); +$ctx2.sendIdx["add:"]=8; +} else { +return $recv(sequence)._add_($recv(statements)._last()); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); +$37=inlinedClosure; +return $37; +}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)}); +}, +args: ["anIRClosure"], +source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure", +referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"], +messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"] +}), +$globals.IRSendInliner); + +$core.addMethod( +$core.method({ +selector: "inlineSend:", +protocol: 'inlining', +fn: function (anIRSend){ +var self=this; +return $core.withContext(function($ctx1) { +var $3,$2,$1; +self._send_(anIRSend); +$3=self._send(); +$ctx1.sendIdx["send"]=1; +$2=$recv($3)._selector(); +$1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)}); +}, +args: ["anIRSend"], +source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst", +referencedClasses: [], +messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"] +}), +$globals.IRSendInliner); + +$core.addMethod( +$core.method({ +selector: "inlinedClosure", +protocol: 'factory', +fn: function (){ +var self=this; +function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($IRInlinedClosure())._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)}); +}, +args: [], +source: "inlinedClosure\x0a\x09^ IRInlinedClosure new", +referencedClasses: ["IRInlinedClosure"], +messageSends: ["new"] +}), +$globals.IRSendInliner); + +$core.addMethod( +$core.method({ +selector: "inlinedSend:with:", +protocol: 'inlining', +fn: function (inlinedSend,anIRInstruction){ +var self=this; +var inlinedClosure; +return $core.withContext(function($ctx1) { +var $1,$2,$5,$4,$3,$6,$7; +$1=$recv(anIRInstruction)._isClosure(); +if(!$core.assert($1)){ +self._inliningError_("Message argument should be a block"); +$ctx1.sendIdx["inliningError:"]=1; +}; +$2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0)); +if(!$core.assert($2)){ +self._inliningError_("Inlined block should have zero argument"); +}; +inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction)); +$5=self._send(); +$ctx1.sendIdx["send"]=1; +$4=$recv($5)._instructions(); +$3=$recv($4)._first(); +$recv(inlinedSend)._add_($3); +$ctx1.sendIdx["add:"]=1; +$6=$recv(inlinedSend)._add_(inlinedClosure); +$recv(self._send())._replaceWith_(inlinedSend); +$7=$recv($recv(inlinedSend)._method())._internalVariables(); +$ctx1.sendIdx["internalVariables"]=1; +$recv($7)._addAll_($recv(inlinedSend)._internalVariables()); +return inlinedSend; +}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)}); +}, +args: ["inlinedSend", "anIRInstruction"], +source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend", +referencedClasses: [], +messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"] +}), +$globals.IRSendInliner); - s0 = peg$currPos; - s1 = peg$parsekeywordPattern(); - if (s1 === peg$FAILED) { - s1 = peg$parsebinaryPattern(); - if (s1 === peg$FAILED) { - s1 = peg$parseunaryPattern(); - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsews(); - if (s2 !== peg$FAILED) { - s3 = peg$parsesequence(); - if (s3 === peg$FAILED) { - s3 = peg$c41; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsews(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c134(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "inlinedSend:with:with:", +protocol: 'inlining', +fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){ +var self=this; +var inlinedClosure1,inlinedClosure2; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$7,$6,$5,$8,$9; +$1=$recv(anIRInstruction)._isClosure(); +$ctx1.sendIdx["isClosure"]=1; +if(!$core.assert($1)){ +self._inliningError_("Message argument should be a block"); +$ctx1.sendIdx["inliningError:"]=1; +}; +$2=$recv(anotherIRInstruction)._isClosure(); +if(!$core.assert($2)){ +self._inliningError_("Message argument should be a block"); +}; +$3=self._translator(); +$ctx1.sendIdx["translator"]=1; +$4=self._inlineClosure_(anIRInstruction); +$ctx1.sendIdx["inlineClosure:"]=1; +inlinedClosure1=$recv($3)._visit_($4); +$ctx1.sendIdx["visit:"]=1; +inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction)); +$7=self._send(); +$ctx1.sendIdx["send"]=1; +$6=$recv($7)._instructions(); +$5=$recv($6)._first(); +$recv(inlinedSend)._add_($5); +$ctx1.sendIdx["add:"]=1; +$recv(inlinedSend)._add_(inlinedClosure1); +$ctx1.sendIdx["add:"]=2; +$8=$recv(inlinedSend)._add_(inlinedClosure2); +$recv(self._send())._replaceWith_(inlinedSend); +$9=$recv($recv(inlinedSend)._method())._internalVariables(); +$ctx1.sendIdx["internalVariables"]=1; +$recv($9)._addAll_($recv(inlinedSend)._internalVariables()); +return inlinedSend; +}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)}); +}, +args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"], +source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend", +referencedClasses: [], +messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"] +}), +$globals.IRSendInliner); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "inlinedSequence", +protocol: 'factory', +fn: function (){ +var self=this; +function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($IRInlinedSequence())._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)}); +}, +args: [], +source: "inlinedSequence\x0a\x09^ IRInlinedSequence new", +referencedClasses: ["IRInlinedSequence"], +messageSends: ["new"] +}), +$globals.IRSendInliner); - return s0; - } +$core.addMethod( +$core.method({ +selector: "inliningError:", +protocol: 'error handling', +fn: function (aString){ +var self=this; +function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)} +return $core.withContext(function($ctx1) { +$recv($InliningError())._signal_(aString); +return self; +}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)}); +}, +args: ["aString"], +source: "inliningError: aString\x0a\x09InliningError signal: aString", +referencedClasses: ["InliningError"], +messageSends: ["signal:"] +}), +$globals.IRSendInliner); - function peg$parseassociationSend() { - var s0, s1, s2; +$core.addMethod( +$core.method({ +selector: "send", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@send"]; +return $1; - var key = peg$currPos * 60 + 57, - cached = peg$cache[key]; +}, +args: [], +source: "send\x0a\x09^ send", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSendInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +$core.addMethod( +$core.method({ +selector: "send:", +protocol: 'accessing', +fn: function (anIRSend){ +var self=this; +self["@send"]=anIRSend; +return self; - s0 = peg$currPos; - s1 = peg$parsebinarySend(); - if (s1 !== peg$FAILED) { - peg$reportedPos = peg$currPos; - s2 = peg$c135(s1); - if (s2) { - s2 = peg$c112; - } else { - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c136(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +}, +args: ["anIRSend"], +source: "send: anIRSend\x0a\x09send := anIRSend", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSendInliner); - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +$core.addMethod( +$core.method({ +selector: "translator", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@translator"]; +return $1; - return s0; - } +}, +args: [], +source: "translator\x0a\x09^ translator", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSendInliner); - function peg$parseassociationList() { - var s0, s1, s2, s3, s4; +$core.addMethod( +$core.method({ +selector: "translator:", +protocol: 'accessing', +fn: function (anASTTranslator){ +var self=this; +self["@translator"]=anASTTranslator; +return self; - var key = peg$currPos * 60 + 58, - cached = peg$cache[key]; +}, +args: ["anASTTranslator"], +source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSendInliner); - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - s0 = peg$currPos; - s1 = peg$parsews(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c51; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsews(); - if (s3 !== peg$FAILED) { - s4 = peg$parseassociationSend(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c89(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "inlinedSelectors", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]; +return $1; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: [], +source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')", +referencedClasses: [], +messageSends: [] +}), +$globals.IRSendInliner.klass); - return s0; - } +$core.addMethod( +$core.method({ +selector: "shouldInline:", +protocol: 'accessing', +fn: function (anIRInstruction){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +var $early={}; +try { +$1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector()); +if(!$core.assert($1)){ +return false; +}; +$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._do_((function(each){ +return $core.withContext(function($ctx2) { +$2=$recv(each)._isClosure(); +if(!$core.assert($2)){ +throw $early=[false]; +}; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +return true; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)}); +}, +args: ["anIRInstruction"], +source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true", +referencedClasses: [], +messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"] +}), +$globals.IRSendInliner.klass); - function peg$parseassociations() { - var s0, s1, s2, s3; - var key = peg$currPos * 60 + 59, - cached = peg$cache[key]; +$core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining'); +$globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};"; +$core.addMethod( +$core.method({ +selector: "assignment", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@assignment"]; +return $1; - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } +}, +args: [], +source: "assignment\x0a\x09^ assignment", +referencedClasses: [], +messageSends: [] +}), +$globals.IRAssignmentInliner); - s0 = peg$currPos; - s1 = peg$parseassociationSend(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseassociationList(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseassociationList(); - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c137(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c1; - } - } else { - peg$currPos = s0; - s0 = peg$c1; - } +$core.addMethod( +$core.method({ +selector: "assignment:", +protocol: 'accessing', +fn: function (aNode){ +var self=this; +self["@assignment"]=aNode; +return self; - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; +}, +args: ["aNode"], +source: "assignment: aNode\x0a\x09assignment := aNode", +referencedClasses: [], +messageSends: [] +}), +$globals.IRAssignmentInliner); - return s0; - } +$core.addMethod( +$core.method({ +selector: "inlineAssignment:", +protocol: 'inlining', +fn: function (anIRAssignment){ +var self=this; +var inlinedAssignment; +function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)} +return $core.withContext(function($ctx1) { +var $1,$2; +self._assignment_(anIRAssignment); +inlinedAssignment=$recv($IRInlinedAssignment())._new(); +$1=$recv(anIRAssignment)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv($1)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(inlinedAssignment)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(anIRAssignment)._replaceWith_(inlinedAssignment); +self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last()); +$2=inlinedAssignment; +return $2; +}, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)}); +}, +args: ["anIRAssignment"], +source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment", +referencedClasses: ["IRInlinedAssignment"], +messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"] +}), +$globals.IRAssignmentInliner); - peg$result = peg$startRuleFunction(); +$core.addMethod( +$core.method({ +selector: "inlineClosure:", +protocol: 'inlining', +fn: function (anIRClosure){ +var self=this; +var inlinedClosure,statements; +function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)} +return $core.withContext(function($ctx1) { +var $2,$1,$4,$3,$5,$7,$8,$6,$9; +inlinedClosure=( +$ctx1.supercall = true, +$globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure])); +$ctx1.supercall = false; +$2=$recv(inlinedClosure)._instructions(); +$ctx1.sendIdx["instructions"]=2; +$1=$recv($2)._last(); +$ctx1.sendIdx["last"]=1; +statements=$recv($1)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv(statements)._ifNotEmpty_((function(){ +return $core.withContext(function($ctx2) { +$4=$recv(statements)._last(); +$ctx2.sendIdx["last"]=2; +$3=$recv($4)._canBeAssigned(); +if($core.assert($3)){ +$5=$recv(statements)._last(); +$ctx2.sendIdx["last"]=3; +$7=$recv($IRAssignment())._new(); +$recv($7)._add_($recv($recv(self._assignment())._instructions())._first()); +$ctx2.sendIdx["add:"]=1; +$recv($7)._add_($recv($recv(statements)._last())._copy()); +$8=$recv($7)._yourself(); +$6=$8; +return $recv($5)._replaceWith_($6); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$9=inlinedClosure; +return $9; +}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)}); +}, +args: ["anIRClosure"], +source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure", +referencedClasses: ["IRAssignment"], +messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"] +}), +$globals.IRAssignmentInliner); - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: "end", description: "end of input" }); - } - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); - } - } - return { - SyntaxError: SyntaxError, - parse: parse - }; -})(); -}); -define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('SUnit'); -$core.packages["SUnit"].innerEval = function (expr) { return eval(expr); }; -$core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining'); +$globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."; +$core.addMethod( +$core.method({ +selector: "inlineClosure:", +protocol: 'inlining', +fn: function (anIRClosure){ +var self=this; +var closure,statements; +function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)} +return $core.withContext(function($ctx1) { +var $1,$3,$2,$4,$5,$6,$7; +closure=( +$ctx1.supercall = true, +$globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure])); +$ctx1.supercall = false; +$1=$recv($recv(closure)._instructions())._last(); +$ctx1.sendIdx["last"]=1; +statements=$recv($1)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv(statements)._ifNotEmpty_((function(){ +return $core.withContext(function($ctx2) { +$3=$recv(statements)._last(); +$ctx2.sendIdx["last"]=2; +$2=$recv($3)._isReturn(); +if(!$core.assert($2)){ +$4=$recv(statements)._last(); +$ctx2.sendIdx["last"]=3; +$5=$recv($IRReturn())._new(); +$recv($5)._add_($recv($recv(statements)._last())._copy()); +$6=$recv($5)._yourself(); +return $recv($4)._replaceWith_($6); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$7=closure; +return $7; +}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)}); +}, +args: ["anIRClosure"], +source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure", +referencedClasses: ["IRReturn"], +messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"] +}), +$globals.IRReturnInliner); -$core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "result", -protocol: 'accessing', -fn: function (){ +selector: "inlineReturn:", +protocol: 'inlining', +fn: function (anIRReturn){ var self=this; -var $1; -$1=self["@result"]; -return $1; - +var return_; +return $core.withContext(function($ctx1) { +var $1,$2; +return_=self._inlinedReturn(); +$1=$recv(anIRReturn)._instructions(); +$ctx1.sendIdx["instructions"]=1; +$recv($1)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(return_)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv(anIRReturn)._replaceWith_(return_); +self._inlineSend_($recv($recv(return_)._instructions())._last()); +$2=return_; +return $2; +}, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "result\x0a\x09^ result", +args: ["anIRReturn"], +source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"] }), -$globals.ResultAnnouncement); +$globals.IRReturnInliner); $core.addMethod( $core.method({ -selector: "result:", -protocol: 'accessing', -fn: function (aTestResult){ +selector: "inlinedReturn", +protocol: 'factory', +fn: function (){ var self=this; -self["@result"]=aTestResult; -return self; - +function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)} +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($IRInlinedReturn())._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestResult"], -source: "result: aTestResult\x0a\x09result := aTestResult", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: [], +source: "inlinedReturn\x0a\x09^ IRInlinedReturn new", +referencedClasses: ["IRInlinedReturn"], +messageSends: ["new"] }), -$globals.ResultAnnouncement); +$globals.IRReturnInliner); -$core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate."; -//>>excludeEnd("ide"); +$core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining'); +$globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"; $core.addMethod( $core.method({ -selector: "assert:", -protocol: 'testing', -fn: function (aBoolean){ +selector: "compileNode:", +protocol: 'compiling', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ir,stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_description_(aBoolean,"Assertion failed"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$recv(self._semanticAnalyzer())._visit_(aNode); +$ctx1.sendIdx["visit:"]=1; +ir=$recv(self._translator())._visit_(aNode); +$ctx1.sendIdx["visit:"]=2; +$recv(self._inliner())._visit_(ir); +$ctx1.sendIdx["visit:"]=3; +$2=self._irTranslator(); +$recv($2)._currentClass_(self._currentClass()); +$recv($2)._visit_(ir); +$3=$recv($2)._contents(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'", +args: ["aNode"], +source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:description:"] +messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"] }), -$globals.TestCase); +$globals.InliningCodeGenerator); $core.addMethod( $core.method({ -selector: "assert:description:", -protocol: 'testing', -fn: function (aBoolean,aString){ +selector: "inliner", +protocol: 'compiling', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -if(!$core.assert(aBoolean)){ -self._signalFailure_(aString); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($IRInliner())._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean", "aString"], -source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "signalFailure:"] +args: [], +source: "inliner\x0a\x09^ IRInliner new", +referencedClasses: ["IRInliner"], +messageSends: ["new"] }), -$globals.TestCase); +$globals.InliningCodeGenerator); $core.addMethod( $core.method({ -selector: "assert:equals:", -protocol: 'testing', -fn: function (actual,expected){ +selector: "irTranslator", +protocol: 'compiling', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$6,$5,$4,$3,$1; -$2=$recv(actual).__eq(expected); -$6=$recv(expected)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=1; -//>>excludeEnd("ctx"); -$5="Expected: ".__comma($6); -$4=$recv($5).__comma(" but was: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$3=$recv($4).__comma($recv(actual)._printString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$1=self._assert_description_($2,$3); +var $1; +$1=$recv($IRInliningJSTranslator())._new(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["actual", "expected"], -source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:description:", "=", ",", "printString"] +args: [], +source: "irTranslator\x0a\x09^ IRInliningJSTranslator new", +referencedClasses: ["IRInliningJSTranslator"], +messageSends: ["new"] }), -$globals.TestCase); +$globals.InliningCodeGenerator); + + +}); + +define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-Interpreter'); +$core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter'); +$globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`)."; $core.addMethod( $core.method({ -selector: "async:", -protocol: 'async', -fn: function (aBlock){ +selector: "applyTo:arguments:", +protocol: 'evaluating', +fn: function (anObject,aCollection){ var self=this; -var c; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -self._errorIfNotAsync_("#async"); -c=self["@context"]; -$1=(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._isAsync(); -if($core.assert($2)){ -return $recv(c)._execute_(aBlock); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)}); -//>>excludeEnd("ctx"); +self._interpreterError(); +return self; +}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]", +args: ["anObject", "aCollection"], +source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"] +messageSends: ["interpreterError"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "context:", +selector: "compiledSource", protocol: 'accessing', -fn: function (aRunningTestContext){ +fn: function (){ var self=this; -self["@context"]=aRunningTestContext; -return self; +return "[ AST Block closure ]"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aRunningTestContext"], -source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext", +args: [], +source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "deny:", -protocol: 'testing', -fn: function (aBoolean){ +selector: "currySelf", +protocol: 'converting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv(aBoolean)._not()); +self._interpreterError(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBoolean"], -source: "deny: aBoolean\x0a\x09self assert: aBoolean not", +args: [], +source: "currySelf\x0a\x09self interpreterError", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "not"] +messageSends: ["interpreterError"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "errorIfNotAsync:", -protocol: 'error handling', -fn: function (aString){ +selector: "initializeWithContext:node:", +protocol: 'initialization', +fn: function (aContext,aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._isAsync(); -if(!$core.assert($1)){ -self._error_($recv(aString).__comma(" used without prior #timeout:")); -}; +self["@node"]=aNode; +self["@outerContext"]=aContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]", +args: ["aContext", "aNode"], +source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "isAsync", "error:", ","] +messageSends: [] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "finished", -protocol: 'async', +selector: "interpreterError", +protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._errorIfNotAsync_("#finished"); -self["@asyncTimeout"]=nil; +$recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter."); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["errorIfNotAsync:"] +source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'", +referencedClasses: ["ASTInterpreterError"], +messageSends: ["signal:"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "isAsync", -protocol: 'testing', +selector: "numArgs", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self["@asyncTimeout"])._notNil(); +$1=$recv($recv(self["@node"])._temps())._size(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isAsync\x0a\x09^ asyncTimeout notNil", +source: "numArgs\x0a\x09^ node temps size", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["notNil"] +messageSends: ["size", "temps"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "performTest", -protocol: 'running', +selector: "value", +protocol: 'evaluating', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@asyncTimeout"]=nil; -self._perform_(self._selector()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._valueWithPossibleArguments_([]); +return $1; +}, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector", +source: "value\x0a\x09^ self valueWithPossibleArguments: #()", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["perform:", "selector"] +messageSends: ["valueWithPossibleArguments:"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "runCase", -protocol: 'running', -fn: function (){ +selector: "value:", +protocol: 'evaluating', +fn: function (anArgument){ var self=this; -function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($TestContext())._testCase_(self))._start(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._valueWithPossibleArguments_([anArgument]); +return $1; +}, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start", -referencedClasses: ["TestContext"], -//>>excludeEnd("ide"); -messageSends: ["start", "testCase:"] +args: ["anArgument"], +source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}", +referencedClasses: [], +messageSends: ["valueWithPossibleArguments:"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "selector", -protocol: 'accessing', -fn: function (){ +selector: "value:value:", +protocol: 'evaluating', +fn: function (firstArgument,secondArgument){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=self["@testSelector"]; +$1=self._valueWithPossibleArguments_([firstArgument,secondArgument]); return $1; +}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)}); +}, +args: ["firstArgument", "secondArgument"], +source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}", +referencedClasses: [], +messageSends: ["valueWithPossibleArguments:"] +}), +$globals.AIBlockClosure); +$core.addMethod( +$core.method({ +selector: "value:value:value:", +protocol: 'evaluating', +fn: function (firstArgument,secondArgument,thirdArgument){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]); +return $1; +}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "selector\x0a\x09^ testSelector", +args: ["firstArgument", "secondArgument", "thirdArgument"], +source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["valueWithPossibleArguments:"] }), -$globals.TestCase); +$globals.AIBlockClosure); $core.addMethod( $core.method({ -selector: "setTestSelector:", -protocol: 'accessing', -fn: function (aSelector){ +selector: "valueWithPossibleArguments:", +protocol: 'evaluating', +fn: function (aCollection){ var self=this; -self["@testSelector"]=aSelector; -return self; +var context,sequenceNode; +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6; +context=$recv(self["@outerContext"])._newInnerContext(); +$1=$recv($recv($recv(self["@node"])._nodes())._first())._copy(); +$recv($1)._parent_(nil); +$2=$recv($1)._yourself(); +sequenceNode=$2; +$recv($recv(sequenceNode)._temps())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(context)._defineLocal_(each); +$ctx2.sendIdx["defineLocal:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){ +return $core.withContext(function($ctx2) { +$recv(context)._defineLocal_(each); +return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){ +return nil; +}))); +}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)}); +})); +$3=$recv(context)._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +$recv($3)._node_($recv(sequenceNode)._nextChild()); +$4=$recv($3)._proceed(); +$5=$recv(self["@outerContext"])._interpreter(); +$ctx1.sendIdx["interpreter"]=2; +$recv($5)._setNonLocalReturnFromContext_(context); +$6=$recv($recv(context)._interpreter())._pop(); +return $6; +}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aSelector"], -source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector", +args: ["aCollection"], +source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"] }), -$globals.TestCase); +$globals.AIBlockClosure); + $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'running', +selector: "forContext:node:", +protocol: 'instance creation', +fn: function (aContext,aNode){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._new(); +$recv($2)._initializeWithContext_node_(aContext,aNode); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)}); +}, +args: ["aContext", "aNode"], +source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself", +referencedClasses: [], +messageSends: ["initializeWithContext:node:", "new", "yourself"] +}), +$globals.AIBlockClosure.klass); + + +$core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter'); +$globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)"; +$core.addMethod( +$core.method({ +selector: "arguments", +protocol: 'interpreting', fn: function (){ var self=this; -return self; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($recv(self._ast())._arguments())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return self._localAt_ifAbsent_(each,(function(){ +return $core.withContext(function($ctx3) { +return self._error_("Argument not in context"); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)}); +}, +args: [], +source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]", +referencedClasses: [], +messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"] +}), +$globals.AIContext); +$core.addMethod( +$core.method({ +selector: "ast", +protocol: 'interpreting', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1,$3,$2,$4,$5,$receiver; +$1=self._isBlockContext(); +if($core.assert($1)){ +$3=self._outerContext(); +if(($receiver = $3) == null || $receiver.isNil){ +$2=$3; +} else { +var context; +context=$receiver; +$2=$recv(context)._ast(); +}; +return $2; +}; +$4=self["@ast"]; +if(($receiver = $4) == null || $receiver.isNil){ +self._initializeAST(); +} else { +$4; +}; +$5=self["@ast"]; +return $5; +}, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp", +source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "should:", -protocol: 'testing', -fn: function (aBlock){ +selector: "basicLocalAt:", +protocol: 'private', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv(aBlock)._value()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._locals())._at_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "should: aBlock\x0a\x09self assert: aBlock value", +args: ["aString"], +source: "basicLocalAt: aString\x0a\x09^ self locals at: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "value"] +messageSends: ["at:", "locals"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "should:raise:", -protocol: 'testing', -fn: function (aBlock,anExceptionClass){ +selector: "basicLocalAt:put:", +protocol: 'private', +fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -return false; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_(anExceptionClass,(function(ex){ -return true; - -}))); +$recv(self._locals())._at_put_(aString,anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anExceptionClass"], -source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])", +args: ["aString", "anObject"], +source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "on:do:", "value"] +messageSends: ["at:put:", "locals"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "shouldnt:raise:", -protocol: 'testing', -fn: function (aBlock,anExceptionClass){ +selector: "basicReceiver", +protocol: 'interpreting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value(); -return true; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_(anExceptionClass,(function(ex){ -return false; - -}))); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._localAt_("self"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anExceptionClass"], -source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])", +args: [], +source: "basicReceiver\x0a\x09^ self localAt: 'self'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "on:do:", "value"] +messageSends: ["localAt:"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "signalFailure:", -protocol: 'private', +selector: "defineLocal:", +protocol: 'accessing', fn: function (aString){ var self=this; -function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($TestFailure())._new(); -$recv($1)._messageText_(aString); -$2=$recv($1)._signal(); +$recv(self._locals())._at_put_(aString,nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal", -referencedClasses: ["TestFailure"], -//>>excludeEnd("ide"); -messageSends: ["messageText:", "new", "signal"] +source: "defineLocal: aString\x0a\x09self locals at: aString put: nil", +referencedClasses: [], +messageSends: ["at:put:", "locals"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "tearDown", -protocol: 'running', -fn: function (){ +selector: "evaluate:on:", +protocol: 'evaluating', +fn: function (aString,anEvaluator){ var self=this; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(anEvaluator)._evaluate_context_(aString,self); +return $1; +}, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "tearDown", +args: ["aString", "anEvaluator"], +source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["evaluate:context:"] }), -$globals.TestCase); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "timeout:", -protocol: 'async', -fn: function (aNumber){ +selector: "evaluateNode:", +protocol: 'evaluating', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=self["@asyncTimeout"]; -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -$recv(self["@asyncTimeout"])._clearTimeout(); -}; -self["@asyncTimeout"]=(0); -self["@asyncTimeout"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_description_(false,"SUnit grace time exhausted"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})))._valueWithTimeout_(aNumber); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($ASTInterpreter())._new(); +$recv($2)._context_(self); +$recv($2)._node_($recv(aNode)._nextChild()); +$recv($2)._proceed(); +$3=$recv($2)._result(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNumber"], -source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"] +args: ["aNode"], +source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result", +referencedClasses: ["ASTInterpreter"], +messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"] }), -$globals.TestCase); - +$globals.AIContext); $core.addMethod( $core.method({ -selector: "allTestSelectors", +selector: "evaluatedSelector", protocol: 'accessing', fn: function (){ var self=this; -var selectors; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -selectors=self._testSelectors(); -$1=self._shouldInheritSelectors(); -if($core.assert($1)){ -$recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors()); -}; -$2=selectors; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@evaluatedSelector"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors", +source: "evaluatedSelector\x0a\x09^ evaluatedSelector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"] +messageSends: [] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "buildSuite", +selector: "evaluatedSelector:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +self["@evaluatedSelector"]=aString; +return self; + +}, +args: ["aString"], +source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString", +referencedClasses: [], +messageSends: [] +}), +$globals.AIContext); + +$core.addMethod( +$core.method({ +selector: "index", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._allTestSelectors())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._selector_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $2,$1,$receiver; +$2=self["@index"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=(0); +} else { +$1=$2; +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]", +source: "index\x0a\x09^ index ifNil: [ 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collect:", "allTestSelectors", "selector:"] +messageSends: ["ifNil:"] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "classTag", +selector: "index:", protocol: 'accessing', -fn: function (){ +fn: function (anInteger){ var self=this; -return "test"; +self["@index"]=anInteger; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'test'", +args: ["anInteger"], +source: "index: anInteger\x0a\x09index := anInteger", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "isAbstract", -protocol: 'testing', +selector: "initializeAST", +protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._name()).__eq("TestCase"); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); +$1=self._method(); +$ctx1.sendIdx["method"]=1; +self["@ast"]=$recv($1)._ast(); +$recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]); +return self; +}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isAbstract\x0a\x09^ self name = 'TestCase'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["=", "name"] +source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast", +referencedClasses: ["SemanticAnalyzer"], +messageSends: ["ast", "method", "visit:", "on:", "methodClass"] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "lookupHierarchyRoot", -protocol: 'accessing', -fn: function (){ +selector: "initializeFromMethodContext:", +protocol: 'initialization', +fn: function (aMethodContext){ var self=this; -function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)} -return $TestCase(); - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$receiver; +self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector()); +self._index_($recv(aMethodContext)._index()); +self._sendIndexes_($recv(aMethodContext)._sendIndexes()); +self._receiver_($recv(aMethodContext)._receiver()); +self._supercall_($recv(aMethodContext)._supercall()); +$1=self._selector_($recv(aMethodContext)._selector()); +$2=$recv(aMethodContext)._outerContext(); +$ctx1.sendIdx["outerContext"]=1; +if(($receiver = $2) == null || $receiver.isNil){ +$2; +} else { +var outer; +outer=$receiver; +$3=$recv(outer)._methodContext(); +if(($receiver = $3) == null || $receiver.isNil){ +$3; +} else { +self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext())); +}; +$4=$recv(aMethodContext)._locals(); +$ctx1.sendIdx["locals"]=1; +$recv($4)._keysAndValuesDo_((function(key,value){ +return $core.withContext(function($ctx2) { +return $recv(self._locals())._at_put_(key,value); +}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); +})); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "lookupHierarchyRoot\x0a\x09^ TestCase", -referencedClasses: ["TestCase"], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aMethodContext"], +source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]", +referencedClasses: [], +messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "selector:", -protocol: 'accessing', -fn: function (aSelector){ +selector: "initializeInterpreter", +protocol: 'initialization', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._setTestSelector_(aSelector); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); +var $1,$2,$3,$receiver; +$1=$recv($ASTInterpreter())._new(); +$recv($1)._context_(self); +$2=$recv($1)._yourself(); +self["@interpreter"]=$2; +$3=self._innerContext(); +if(($receiver = $3) == null || $receiver.isNil){ +$3; +} else { +self._setupInterpreter_(self["@interpreter"]); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aSelector"], -source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["setTestSelector:", "new", "yourself"] +args: [], +source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]", +referencedClasses: ["ASTInterpreter"], +messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "shouldInheritSelectors", -protocol: 'testing', +selector: "initializeLocals", +protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self.__tild_eq(self._lookupHierarchyRoot()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); +self["@locals"]=$recv($Dictionary())._new(); +$recv(self["@locals"])._at_put_("thisContext",self); +return self; +}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["~=", "lookupHierarchyRoot"] +source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:"] }), -$globals.TestCase.klass); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "testSelectors", +selector: "innerContext", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._match_("^test"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +$1=self["@innerContext"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]", +source: "innerContext\x0a\x09^ innerContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["select:", "keys", "methodDictionary", "match:"] +messageSends: [] }), -$globals.TestCase.klass); - +$globals.AIContext); -$core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "execute:", -protocol: 'running', -fn: function (aBlock){ +selector: "innerContext:", +protocol: 'accessing', +fn: function (anAIContext){ var self=this; -var failed; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$recv(self["@testCase"])._context_(self); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["context:"]=1; -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -failed=true; -failed; -$recv(aBlock)._value(); -failed=false; -return failed; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._ensure_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(self["@testCase"])._context_(nil); -$1=$recv(failed)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(self["@testCase"])._isAsync(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["isAsync"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -if($core.assert($1)){ -$recv(self["@testCase"])._finished(); -}; -$2=$recv(self["@testCase"])._isAsync(); -if(!$core.assert($2)){ -return $recv(self["@testCase"])._tearDown(); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +self["@innerContext"]=anAIContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]", +args: ["anAIContext"], +source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"] +messageSends: [] }), -$globals.TestContext); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "start", -protocol: 'running', +selector: "interpreter", +protocol: 'interpreting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._execute_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(self["@testCase"])._setUp(); -return $recv(self["@testCase"])._performTest(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)}); -//>>excludeEnd("ctx"); +var $1,$2,$receiver; +$1=self["@interpreter"]; +if(($receiver = $1) == null || $receiver.isNil){ +self._initializeInterpreter(); +} else { +$1; +}; +$2=self["@interpreter"]; +return $2; +}, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]", +source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["execute:", "setUp", "performTest"] +messageSends: ["ifNil:", "initializeInterpreter"] }), -$globals.TestContext); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "testCase:", -protocol: 'accessing', -fn: function (aTestCase){ +selector: "interpreter:", +protocol: 'interpreting', +fn: function (anInterpreter){ var self=this; -self["@testCase"]=aTestCase; +self["@interpreter"]=anInterpreter; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestCase"], -source: "testCase: aTestCase\x0a\x09testCase := aTestCase", +args: ["anInterpreter"], +source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestContext); - +$globals.AIContext); $core.addMethod( $core.method({ -selector: "testCase:", -protocol: 'instance creation', -fn: function (aTestCase){ +selector: "isTopContext", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._testCase_(aTestCase); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$recv(self._innerContext())._isNil(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)}); +}, +args: [], +source: "isTopContext\x0a\x09^ self innerContext isNil", +referencedClasses: [], +messageSends: ["isNil", "innerContext"] +}), +$globals.AIContext); + +$core.addMethod( +$core.method({ +selector: "localAt:", +protocol: 'accessing', +fn: function (aString){ +var self=this; +var context; +return $core.withContext(function($ctx1) { +var $1; +context=self._lookupContextForLocal_(aString); +$1=$recv(context)._basicLocalAt_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestCase"], -source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself", +args: ["aString"], +source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testCase:", "new", "yourself"] +messageSends: ["lookupContextForLocal:", "basicLocalAt:"] }), -$globals.TestContext.klass); - +$globals.AIContext); -$core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "execute:", -protocol: 'running', -fn: function (aBlock){ +selector: "localAt:ifAbsent:", +protocol: 'accessing', +fn: function (aString,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var context; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +var $early={}; +try { +context=self._lookupContextForLocal_ifNone_(aString,(function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._withErrorReporting_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.supercall = true, -//>>excludeEnd("ctx"); -$globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.supercall = false; -//>>excludeEnd("ctx");; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=$recv(aBlock)._value(); +throw $early=[$1]; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._ensure_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(self["@testCase"])._isAsync(); -if(!$core.assert($1)){ -$recv(self["@result"])._increaseRuns(); -return $recv(self["@finished"])._value(); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); })); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)}); -//>>excludeEnd("ctx"); +$2=$recv(context)._basicLocalAt_(aString); +return $2; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]", +args: ["aString", "aBlock"], +source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"] +messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"] }), -$globals.ReportingTestContext); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "finished:", +selector: "localAt:put:", protocol: 'accessing', -fn: function (aBlock){ +fn: function (aString,anObject){ var self=this; -self["@finished"]=aBlock; +var context; +return $core.withContext(function($ctx1) { +context=self._lookupContextForLocal_(aString); +$recv(context)._basicLocalAt_put_(aString,anObject); return self; - +}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "finished: aBlock\x0a\x09finished := aBlock", +args: ["aString", "anObject"], +source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"] }), -$globals.ReportingTestContext); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "result:", +selector: "locals", protocol: 'accessing', -fn: function (aTestResult){ +fn: function (){ var self=this; -self["@result"]=aTestResult; -return self; +return $core.withContext(function($ctx1) { +var $1,$2,$receiver; +$1=self["@locals"]; +if(($receiver = $1) == null || $receiver.isNil){ +self._initializeLocals(); +} else { +$1; +}; +$2=self["@locals"]; +return $2; +}, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)}); +}, +args: [], +source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals", +referencedClasses: [], +messageSends: ["ifNil:", "initializeLocals"] +}), +$globals.AIContext); +$core.addMethod( +$core.method({ +selector: "lookupContextForLocal:", +protocol: 'private', +fn: function (aString){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._lookupContextForLocal_ifNone_(aString,(function(){ +return $core.withContext(function($ctx2) { +return self._variableNotFound(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestResult"], -source: "result: aTestResult\x0a\x09result := aTestResult", +args: ["aString"], +source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"] }), -$globals.ReportingTestContext); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "withErrorReporting:", +selector: "lookupContextForLocal:ifNone:", protocol: 'private', -fn: function (aBlock){ +fn: function (aString,aBlock){ var self=this; -function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1; +$1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){ +return self; + +}),(function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aBlock)._on_do_($TestFailure(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$2=self._outerContext(); +return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){ return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(self["@result"])._addFailure_(self["@testCase"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)}); -//>>excludeEnd("ctx"); +return $recv(context)._lookupContextForLocal_(aString); +}, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@result"])._addError_(self["@testCase"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)}); -//>>excludeEnd("ctx"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]", -referencedClasses: ["TestFailure", "Error"], -//>>excludeEnd("ide"); -messageSends: ["on:do:", "addFailure:", "addError:"] +args: ["aString", "aBlock"], +source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]", +referencedClasses: [], +messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"] }), -$globals.ReportingTestContext); - +$globals.AIContext); $core.addMethod( $core.method({ -selector: "testCase:result:finished:", -protocol: 'instance creation', -fn: function (aTestCase,aTestResult,aBlock){ +selector: "newInnerContext", +protocol: 'factory', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv($2)._result_(aTestResult); -$recv($2)._finished_(aBlock); +$2=$recv(self._class())._new(); +$recv($2)._outerContext_(self); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestCase", "aTestResult", "aBlock"], -source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself", +args: [], +source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["result:", "testCase:", "finished:", "yourself"] +messageSends: ["outerContext:", "new", "class", "yourself"] }), -$globals.ReportingTestContext.klass); - +$globals.AIContext); -$core.addClass('TestFailure', $globals.Error, [], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds."; -//>>excludeEnd("ide"); +$core.addMethod( +$core.method({ +selector: "outerContext", +protocol: 'accessing', +fn: function (){ +var self=this; +var $1; +$1=self["@outerContext"]; +return $1; +}, +args: [], +source: "outerContext\x0a\x09^ outerContext", +referencedClasses: [], +messageSends: [] +}), +$globals.AIContext); -$core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "addError:", +selector: "outerContext:", protocol: 'accessing', -fn: function (anError){ +fn: function (anAIContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._errors())._add_(anError); +var $1,$receiver; +self["@outerContext"]=anAIContext; +$1=self["@outerContext"]; +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +var context; +context=$receiver; +$recv(context)._innerContext_(self); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anError"], -source: "addError: anError\x0a\x09self errors add: anError", +args: ["anAIContext"], +source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "errors"] +messageSends: ["ifNotNil:", "innerContext:"] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "addFailure:", -protocol: 'accessing', -fn: function (aFailure){ +selector: "receiver:", +protocol: 'interpreting', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._failures())._add_(aFailure); +$recv(self._locals())._at_put_("self",anObject); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aFailure"], -source: "addFailure: aFailure\x0a\x09self failures add: aFailure", +args: ["anObject"], +source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "failures"] +messageSends: ["at:put:", "locals"] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "errors", +selector: "selector", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@errors"]; +$1=self["@selector"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "errors\x0a\x09^ errors", +source: "selector\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "failures", +selector: "selector:", protocol: 'accessing', -fn: function (){ +fn: function (aString){ var self=this; -var $1; -$1=self["@failures"]; -return $1; +self["@selector"]=aString; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "failures\x0a\x09^ failures", +args: ["aString"], +source: "selector: aString\x0a\x09selector := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "increaseRuns", +selector: "sendIndexAt:", protocol: 'accessing', -fn: function (){ +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@runs"]=$recv(self["@runs"]).__plus((1)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){ +return (0); + +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "increaseRuns\x0a\x09runs := runs + 1", +args: ["aString"], +source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["+"] +messageSends: ["at:ifAbsent:", "sendIndexes"] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', +selector: "sendIndexes", +protocol: 'accessing', fn: function (){ var self=this; -function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)} -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@timestamp"]=$recv($Date())._now(); -self["@runs"]=(0); -self["@errors"]=$recv($Array())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -self["@failures"]=$recv($Array())._new(); -self["@total"]=(0); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self["@sendIndexes"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$recv($Dictionary())._new(); +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0", -referencedClasses: ["Date", "Array"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "now", "new"] +source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]", +referencedClasses: ["Dictionary"], +messageSends: ["ifNil:", "new"] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "nextRunDo:", -protocol: 'running', -fn: function (aBlock){ +selector: "sendIndexes:", +protocol: 'accessing', +fn: function (aDictionary){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -$3=self._runs(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["runs"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3).__eq_eq(self._total()); -if(!$core.assert($2)){ -$1=$recv(aBlock)._value_($recv(self._runs()).__plus((1))); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)}); -//>>excludeEnd("ctx"); +self["@sendIndexes"]=aDictionary; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]", +args: ["aDictionary"], +source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"] +messageSends: [] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "runCase:", -protocol: 'running', -fn: function (aTestCase){ +selector: "setupInterpreter:", +protocol: 'interpreting', +fn: function (anInterpreter){ var self=this; -function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var currentNode; +function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3,$4,$5,$8,$7,$6,$receiver; +$1=$recv($ASTPCNodeVisitor())._new(); +$recv($1)._selector_(self._evaluatedSelector()); +$recv($1)._context_(self); +$2=$1; +$3=self._ast(); +$ctx1.sendIdx["ast"]=1; +$recv($2)._visit_($3); +$4=$recv($1)._currentNode(); +currentNode=$4; +$5=$recv(self._ast())._sequenceNode(); +if(($receiver = $5) == null || $receiver.isNil){ +$5; +} else { +var sequence; +sequence=$receiver; +$recv($recv(sequence)._temps())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -self._increaseRuns(); -return $recv(aTestCase)._runCase(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._on_do_($TestFailure(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._addFailure_(aTestCase); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)}); -//>>excludeEnd("ctx"); +return self._defineLocal_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$ctx1.sendIdx["do:"]=1; +}; +$recv(anInterpreter)._node_(currentNode); +$8=self._innerContext(); +$ctx1.sendIdx["innerContext"]=1; +$7=$recv($8)._arguments(); +$6=$recv($7)._reversed(); +$recv($6)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._addError_(aTestCase); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)}); -//>>excludeEnd("ctx"); +return $recv(anInterpreter)._push_(each); +$ctx2.sendIdx["push:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); +$recv(anInterpreter)._push_($recv(self._innerContext())._receiver()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aTestCase"], -source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]", -referencedClasses: ["TestFailure", "Error"], -//>>excludeEnd("ide"); -messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"] +args: ["anInterpreter"], +source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)", +referencedClasses: ["ASTPCNodeVisitor"], +messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "runs", -protocol: 'accessing', +selector: "supercall", +protocol: 'interpreting', fn: function (){ var self=this; -var $1; -$1=self["@runs"]; +return $core.withContext(function($ctx1) { +var $2,$1,$receiver; +$2=self["@supercall"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; +}; return $1; - +}, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "runs\x0a\x09^ runs", +source: "supercall\x0a\x09^ supercall ifNil: [ false ]", +referencedClasses: [], +messageSends: ["ifNil:"] +}), +$globals.AIContext); + +$core.addMethod( +$core.method({ +selector: "supercall:", +protocol: 'interpreting', +fn: function (aBoolean){ +var self=this; +self["@supercall"]=aBoolean; +return self; + +}, +args: ["aBoolean"], +source: "supercall: aBoolean\x0a\x09supercall := aBoolean", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestResult); +$globals.AIContext); $core.addMethod( $core.method({ -selector: "status", -protocol: 'accessing', +selector: "variableNotFound", +protocol: 'error handling', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); +self._error_("Variable missing"); +return self; +}, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)}); +}, +args: [], +source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'", +referencedClasses: [], +messageSends: ["error:"] +}), +$globals.AIContext); + + +$core.addMethod( +$core.method({ +selector: "fromMethodContext:", +protocol: 'instance creation', +fn: function (aMethodContext){ +var self=this; +return $core.withContext(function($ctx1) { var $2,$3,$1; -$2=$recv(self._errors())._isEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isEmpty"]=1; -//>>excludeEnd("ctx"); -if($core.assert($2)){ -$3=$recv(self._failures())._isEmpty(); -if($core.assert($3)){ -$1="success"; -} else { -$1="failure"; -}; -} else { -$1="error"; -}; +$2=self._new(); +$recv($2)._initializeFromMethodContext_(aMethodContext); +$3=$recv($2)._yourself(); +$1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]", +args: ["aMethodContext"], +source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"] +messageSends: ["initializeFromMethodContext:", "new", "yourself"] }), -$globals.TestResult); +$globals.AIContext.klass); + +$core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter'); +$globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables."; $core.addMethod( $core.method({ -selector: "timestamp", +selector: "context", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@timestamp"]; +$1=self["@context"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "timestamp\x0a\x09^ timestamp", +source: "context\x0a\x09^ context", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestResult); +$globals.AISemanticAnalyzer); $core.addMethod( $core.method({ -selector: "total", +selector: "context:", protocol: 'accessing', -fn: function (){ +fn: function (anAIContext){ var self=this; -var $1; -$1=self["@total"]; -return $1; +self["@context"]=anAIContext; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "total\x0a\x09^ total", +args: ["anAIContext"], +source: "context: anAIContext\x0a\x09context := anAIContext", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestResult); +$globals.AISemanticAnalyzer); $core.addMethod( $core.method({ -selector: "total:", -protocol: 'accessing', -fn: function (aNumber){ +selector: "visitVariableNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -self["@total"]=aNumber; +function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)} +return $core.withContext(function($ctx1) { +var $1; +var $early={}; +try { +$recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){ +return $core.withContext(function($ctx2) { +$1=( +$ctx2.supercall = true, +$globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode])); +$ctx2.supercall = false; +throw $early=[$1]; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$recv(aNode)._binding_($recv($ASTContextVar())._new()); return self; - +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNumber"], -source: "total: aNumber\x0a\x09total := aNumber", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aNode"], +source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new", +referencedClasses: ["ASTContextVar"], +messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"] }), -$globals.TestResult); +$globals.AISemanticAnalyzer); -$core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`."; -//>>excludeEnd("ide"); +$core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter'); +$globals.ASTContextVar.comment="I am a variable defined in a `context`."; $core.addMethod( $core.method({ -selector: "announcer", +selector: "context", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@announcer"]; +$1=self["@context"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "announcer\x0a\x09^ announcer", +source: "context\x0a\x09^ context", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestSuiteRunner); +$globals.ASTContextVar); $core.addMethod( $core.method({ -selector: "contextOf:", -protocol: 'private', -fn: function (anInteger){ +selector: "context:", +protocol: 'accessing', +fn: function (anObject){ var self=this; -function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._resume(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)}); -//>>excludeEnd("ctx"); +self["@context"]=anObject; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anInteger"], -source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]", -referencedClasses: ["ReportingTestContext"], -//>>excludeEnd("ide"); -messageSends: ["testCase:result:finished:", "at:", "resume"] +args: ["anObject"], +source: "context: anObject\x0a\x09context := anObject", +referencedClasses: [], +messageSends: [] }), -$globals.TestSuiteRunner); +$globals.ASTContextVar); + + +$core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter'); +$globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping."; $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', +selector: "atEnd", +protocol: 'testing', fn: function (){ var self=this; -function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} -function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -self["@announcer"]=$recv($Announcer())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -self["@result"]=$recv($TestResult())._new(); -self["@runNextTest"]=(function(){ -var runs; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -runs=$recv(self["@result"])._runs(); -runs; -$1=$recv(runs).__lt($recv(self["@result"])._total()); -if($core.assert($1)){ -return $recv(self._contextOf_($recv(runs).__plus((1))))._start(); +var $1,$2,$receiver; +$1=self._context(); +$ctx1.sendIdx["context"]=1; +if(($receiver = $1) == null || $receiver.isNil){ +return true; +} else { +$1; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)}); -//>>excludeEnd("ctx"); +$2=$recv($recv(self._interpreter())._atEnd())._and_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._context())._isTopContext(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +return $2; +}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].", -referencedClasses: ["Announcer", "TestResult"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"] +source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]", +referencedClasses: [], +messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"] }), -$globals.TestSuiteRunner); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "result", +selector: "context", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@result"]; +$1=self["@context"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "result\x0a\x09^ result", +source: "context\x0a\x09^ context", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.TestSuiteRunner); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "resume", +selector: "context:", +protocol: 'accessing', +fn: function (aContext){ +var self=this; +self["@context"]=aContext; +return self; + +}, +args: ["aContext"], +source: "context: aContext\x0a\x09context := aContext", +referencedClasses: [], +messageSends: [] +}), +$globals.ASTDebugger); + +$core.addMethod( +$core.method({ +selector: "flushInnerContexts", protocol: 'actions', fn: function (){ var self=this; -function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@runNextTest"])._fork(); -$recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"])); +var $1,$receiver; +$1=self._context(); +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +var cxt; +cxt=$receiver; +$recv(cxt)._innerContext_(nil); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)", -referencedClasses: ["ResultAnnouncement"], -//>>excludeEnd("ide"); -messageSends: ["fork", "announce:", "result:", "new"] +source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]", +referencedClasses: [], +messageSends: ["ifNotNil:", "context", "innerContext:"] }), -$globals.TestSuiteRunner); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "run", -protocol: 'actions', +selector: "interpreter", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self["@result"])._total_($recv(self["@suite"])._size()); -self._resume(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self._context(); +if(($receiver = $2) == null || $receiver.isNil){ +$1=$2; +} else { +var ctx; +ctx=$receiver; +$1=$recv(ctx)._interpreter(); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "run\x0a\x09result total: suite size.\x0a\x09self resume", +source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["total:", "size", "resume"] +messageSends: ["ifNotNil:", "context", "interpreter"] }), -$globals.TestSuiteRunner); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "suite:", +selector: "method", protocol: 'accessing', -fn: function (aCollection){ +fn: function (){ var self=this; -self["@suite"]=aCollection; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._context())._method(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "suite: aCollection\x0a\x09suite := aCollection", +args: [], +source: "method\x0a\x09^ self context method", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["method", "context"] }), -$globals.TestSuiteRunner); - +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "new", -protocol: 'instance creation', +selector: "node", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._shouldNotImplement(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)}); -//>>excludeEnd("ctx"); +var $2,$1,$receiver; +$2=self._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +if(($receiver = $2) == null || $receiver.isNil){ +$1=$2; +} else { +$1=$recv(self._interpreter())._node(); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "new\x0a\x09self shouldNotImplement", +source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["shouldNotImplement"] +messageSends: ["ifNotNil:", "interpreter", "node"] }), -$globals.TestSuiteRunner.klass); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "on:", -protocol: 'instance creation', -fn: function (aCollection){ +selector: "onStep", +protocol: 'private', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=$recv($2)._suite_(aCollection); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)}); -//>>excludeEnd("ctx"); +var $1,$3,$2,$4,$6,$5,$receiver; +$1=self._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +self["@result"]=$recv($1)._result(); +$3=self._interpreter(); +$ctx1.sendIdx["interpreter"]=2; +$2=$recv($3)._atEnd(); +$ctx1.sendIdx["atEnd"]=1; +if($core.assert($2)){ +$4=$recv(self._context())._outerContext(); +if(($receiver = $4) == null || $receiver.isNil){ +$4; +} else { +var outerContext; +outerContext=$receiver; +self._context_(outerContext); +}; +$6=self._interpreter(); +$ctx1.sendIdx["interpreter"]=3; +$5=$recv($6)._atEnd(); +if(!$core.assert($5)){ +$recv(self._interpreter())._skip(); +}; +}; +self._flushInnerContexts(); +return self; +}, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection"], -source: "on: aCollection\x0a\x09^ super new suite: aCollection", +args: [], +source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["suite:", "new"] +messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"] }), -$globals.TestSuiteRunner.klass); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "isTestClass", -protocol: '*SUnit', +selector: "proceed", +protocol: 'stepping', fn: function (){ var self=this; -function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._includesBehavior_($TestCase()))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._isAbstract())._not(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._atEnd(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); +}))._whileFalse_((function(){ +return $core.withContext(function($ctx2) { +return self._stepOver(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); })); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)}); -//>>excludeEnd("ctx"); +return self; +}, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]", -referencedClasses: ["TestCase"], -//>>excludeEnd("ide"); -messageSends: ["and:", "includesBehavior:", "not", "isAbstract"] +source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]", +referencedClasses: [], +messageSends: ["whileFalse:", "atEnd", "stepOver"] }), -$globals.Behavior); +$globals.ASTDebugger); $core.addMethod( $core.method({ -selector: "isTestPackage", -protocol: '*SUnit', +selector: "restart", +protocol: 'stepping', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); +$recv(self._interpreter())._restart(); +self._flushInnerContexts(); +return self; +}, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)}); +}, +args: [], +source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts", +referencedClasses: [], +messageSends: ["restart", "interpreter", "flushInnerContexts"] +}), +$globals.ASTDebugger); + +$core.addMethod( +$core.method({ +selector: "result", +protocol: 'accessing', +fn: function (){ +var self=this; var $1; -$1=$recv(self._classes())._anySatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._isTestClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +$1=self["@result"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]", +source: "result\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["anySatisfy:", "classes", "isTestClass"] +messageSends: [] }), -$globals.Package); - -}); +$globals.ASTDebugger); -define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Platform-ImportExport'); -$core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addMethod( +$core.method({ +selector: "stepInto", +protocol: 'stepping', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._shouldBeImplemented(); +return self; +}, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)}); +}, +args: [], +source: "stepInto\x0a\x09self shouldBeImplemented", +referencedClasses: [], +messageSends: ["shouldBeImplemented"] +}), +$globals.ASTDebugger); -$core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "classNameFor:", -protocol: 'convenience', -fn: function (aClass){ +selector: "stepOver", +protocol: 'stepping', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$1; -$2=$recv(aClass)._isMetaclass(); -if($core.assert($2)){ -$3=$recv($recv(aClass)._instanceClass())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); -$1=$recv($3).__comma(" class"); -} else { -$4=$recv(aClass)._isNil(); -if($core.assert($4)){ -$1="nil"; +var $1,$2; +$1=$recv(self._context())._isTopContext(); +if($core.assert($1)){ +$recv(self._interpreter())._stepOver(); } else { -$1=$recv(aClass)._name(); -}; +$2=self._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +$recv($2)._skip(); }; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)}); -//>>excludeEnd("ctx"); +self._onStep(); +return self; +}, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]", +args: [], +source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"] +messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"] }), -$globals.AbstractExporter); +$globals.ASTDebugger); + $core.addMethod( $core.method({ -selector: "exportPackage:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "context:", +protocol: 'instance creation', +fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=self._new(); +$recv($2)._context_(aContext); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility", +args: ["aContext"], +source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["context:", "new", "yourself"] }), -$globals.AbstractExporter); +$globals.ASTDebugger.klass); + +$core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter'); +$globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any"; $core.addMethod( $core.method({ -selector: "extensionMethodsOfPackage:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "assign:to:", +protocol: 'private', +fn: function (aNode,anObject){ var self=this; -var result; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -result=$recv($OrderedCollection())._new(); -$recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(result)._addAll_($recv(each)._methods()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=result; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)}); -//>>excludeEnd("ctx"); +var $1,$3,$2,$4; +$1=$recv($recv(aNode)._binding())._isInstanceVar(); +if($core.assert($1)){ +$3=self._context(); +$ctx1.sendIdx["context"]=1; +$2=$recv($3)._receiver(); +$4=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=1; +$recv($2)._instVarAt_put_($4,anObject); +} else { +$recv(self._context())._localAt_put_($recv(aNode)._value(),anObject); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"] +args: ["aNode", "anObject"], +source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]", +referencedClasses: [], +messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"] }), -$globals.AbstractExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "extensionProtocolsOfPackage:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "atEnd", +protocol: 'testing', +fn: function (){ var self=this; -var extensionName,result; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$1=$recv(aPackage)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); -extensionName="*".__comma($1); -result=$recv($OrderedCollection())._new(); -$recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(a)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["name"]=2; -//>>excludeEnd("ctx"); -return $recv($2).__lt($recv(b)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv([each,$recv(each)._class()])._do_((function(behavior){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$3=$recv($recv(behavior)._protocols())._includes_(extensionName); -if($core.assert($3)){ -return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior)); +var $1,$2; +$1=self["@forceAtEnd"]; +if($core.assert($1)){ +return true; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); +$2=$recv(self._hasReturned())._or_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._node())._isNil(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$4=result; -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)}); -//>>excludeEnd("ctx"); +return $2; +}, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result", -referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"], -//>>excludeEnd("ide"); -messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"] +args: [], +source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]", +referencedClasses: [], +messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"] }), -$globals.AbstractExporter); - - +$globals.ASTInterpreter); -$core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "chunkEscape:", -protocol: 'convenience', -fn: function (aString){ +selector: "context", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth(); +$1=self["@context"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth", +args: [], +source: "context\x0a\x09^ context", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["trimBoth", "replace:with:"] +messageSends: [] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportCategoryEpilogueOf:on:", -protocol: 'output', -fn: function (aCategory,aStream){ +selector: "context:", +protocol: 'accessing', +fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(aStream)._nextPutAll_(" !"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$1=$recv(aStream)._lf(); +self["@context"]=aContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCategory", "aStream"], -source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf", +args: ["aContext"], +source: "context: aContext\x0a\x09context := aContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf"] +messageSends: [] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportCategoryPrologueOf:on:", -protocol: 'output', -fn: function (aCategory,aStream){ +selector: "eval:", +protocol: 'private', +fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var source,function_; +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2; -$1="!".__comma(self._classNameFor_($recv(aCategory)._theClass())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$2=$recv(aStream)._nextPutAll_($3); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +var $3,$2,$1,$4,$5; +source=$recv($String())._streamContents_((function(str){ +return $core.withContext(function($ctx2) { +$recv(str)._nextPutAll_("0,(function("); +$ctx2.sendIdx["nextPutAll:"]=1; +$3=self._context(); +$ctx2.sendIdx["context"]=1; +$2=$recv($3)._locals(); +$ctx2.sendIdx["locals"]=1; +$1=$recv($2)._keys(); +$recv($1)._do_separatedBy_((function(each){ +return $core.withContext(function($ctx3) { +return $recv(str)._nextPutAll_(each); +$ctx3.sendIdx["nextPutAll:"]=2; +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)}); +}),(function(){ +return $core.withContext(function($ctx3) { +return $recv(str)._nextPutAll_(","); +$ctx3.sendIdx["nextPutAll:"]=3; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +$recv(str)._nextPutAll_("){ return (function() {"); +$ctx2.sendIdx["nextPutAll:"]=4; +$recv(str)._nextPutAll_(aString); +$ctx2.sendIdx["nextPutAll:"]=5; +$4=$recv(str)._nextPutAll_("})()})"); +return $4; +}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); +})); +function_=$recv($recv($Compiler())._new())._eval_(source); +$5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values()); +return $5; +}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCategory", "aStream"], -source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"] +args: ["aString"], +source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values", +referencedClasses: ["String", "Compiler"], +messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportDefinitionOf:on:", -protocol: 'output', -fn: function (aClass,aStream){ +selector: "hasReturned", +protocol: 'testing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12; -$1=self._classNameFor_($recv(aClass)._superclass()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["classNameFor:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$3=self._classNameFor_(aClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["classNameFor:"]=2; -//>>excludeEnd("ctx"); -$2=" subclass: #".__comma($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._tab(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["tab"]=1; -//>>excludeEnd("ctx"); -$4=$recv(aStream)._nextPutAll_("instanceVariableNames: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(aStream)._nextPutAll_("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._tab(); -$6="package: '".__comma($recv(aClass)._category()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -$5=$recv($6).__comma("'!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$7=$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$9=$recv(aClass)._comment(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["comment"]=1; -//>>excludeEnd("ctx"); -$8=$recv($9)._notEmpty(); -if($core.assert($8)){ -$11="!".__comma(self._classNameFor_(aClass)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$10=$recv($11).__comma(" commentStamp!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!")); -$12=$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=5; -//>>excludeEnd("ctx"); -$12; +var $2,$1,$receiver; +$2=self["@returned"]; +if(($receiver = $2) == null || $receiver.isNil){ +$1=false; +} else { +$1=$2; }; -$recv(aStream)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass", "aStream"], -source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf", +args: [], +source: "hasReturned\x0a\x09^ returned ifNil: [ false ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"] +messageSends: ["ifNil:"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportMetaDefinitionOf:on:", -protocol: 'output', -fn: function (aClass,aStream){ +selector: "initialize", +protocol: 'initialization', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$5,$4,$6,$7; -$3=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._instanceVariableNames(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instanceVariableNames"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isEmpty(); -if(!$core.assert($1)){ -$5=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=2; -//>>excludeEnd("ctx"); -$4=self._classNameFor_($5); -$recv(aStream)._nextPutAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$6; -$recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$recv(aStream)._nextPutAll_("'!"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$7=$recv(aStream)._lf(); -$7; -}; +( +$ctx1.supercall = true, +$globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +self["@forceAtEnd"]=false; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass", "aStream"], -source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]", +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"] +messageSends: ["initialize"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportMethod:on:", -protocol: 'output', -fn: function (aMethod,aStream){ +selector: "interpret", +protocol: 'interpreting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -$1=$recv(aStream)._nextPutAll_("!"); +self._visit_(self._node()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethod", "aStream"], -source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'", +args: [], +source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"] +messageSends: ["visit:", "node"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackage:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "interpret:", +protocol: 'interpreting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -self._exportPackageDefinitionOf_on_(aPackage,aStream); -$1=self._exportPackageImportsOf_on_(aPackage,aStream); -$recv($recv(aPackage)._sortedClasses())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self._exportDefinitionOf_on_(each,aStream); -$2=self._ownMethodProtocolsOfClass_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1; -//>>excludeEnd("ctx"); -self._exportProtocols_on_($2,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["exportProtocols:on:"]=1; -//>>excludeEnd("ctx"); -self._exportMetaDefinitionOf_on_(each,aStream); -return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["exportProtocols:on:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream); +self._node_(aNode); +self._interpret(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream", +args: ["aNode"], +source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"] +messageSends: ["node:", "interpret"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageDefinitionOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "messageFromSendNode:arguments:", +protocol: 'private', +fn: function (aSendNode,aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -$2=$recv(aStream)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($Message())._new(); +$recv($2)._selector_($recv(aSendNode)._selector()); +$recv($2)._arguments_(aCollection); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", ",", "name", "lf"] +args: ["aSendNode", "aCollection"], +source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself", +referencedClasses: ["Message"], +messageSends: ["selector:", "new", "selector", "arguments:", "yourself"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageImportsOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "messageNotUnderstood:receiver:", +protocol: 'private', +fn: function (aMessage,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("(Smalltalk packageAt: '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv(aPackage)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("') imports: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("!"); -$1=$recv(aStream)._lf(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1,$2; +$1=$recv($MessageNotUnderstood())._new(); +$recv($1)._meesage_(aMessage); +$recv($1)._receiver_(anObject); +$2=$recv($1)._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"] +args: ["aMessage", "anObject"], +source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["meesage:", "new", "receiver:", "signal"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportProtocol:on:", -protocol: 'output', -fn: function (aProtocol,aStream){ +selector: "next", +protocol: 'interpreting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._exportProtocolPrologueOf_on_(aProtocol,aStream); -$recv($recv(aProtocol)._methods())._do_((function(method){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._exportMethod_on_(method,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._exportProtocolEpilogueOf_on_(aProtocol,aStream); +self._node_($recv(self._node())._nextNode()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aProtocol", "aStream"], -source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream", +args: [], +source: "next\x0a\x09self node: self node nextNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"] +messageSends: ["node:", "nextNode", "node"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportProtocolEpilogueOf:on:", -protocol: 'output', -fn: function (aProtocol,aStream){ +selector: "node", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$recv(aStream)._nextPutAll_(" !"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$1=$recv(aStream)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +$1=self["@node"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aProtocol", "aStream"], -source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf", +args: [], +source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf"] +messageSends: [] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportProtocolPrologueOf:on:", -protocol: 'output', -fn: function (aProtocol,aStream){ +selector: "node:", +protocol: 'accessing', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2; -$1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$2=$recv(aStream)._nextPutAll_($3); +self["@node"]=aNode; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aProtocol", "aStream"], -source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'", + +}, +args: ["aNode"], +source: "node: aNode\x0a\x09node := aNode", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"] +messageSends: [] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportProtocols:on:", -protocol: 'output', -fn: function (aCollection,aStream){ +selector: "peek", +protocol: 'stack', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._exportProtocol_on_(each,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); +var $1,$2; +var $early={}; +try { +$1=self._stack(); +$ctx1.sendIdx["stack"]=1; +$recv($1)._ifEmpty_((function(){ +throw $early=[nil]; + })); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +$2=$recv(self._stack())._last(); +return $2; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection", "aStream"], -source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]", +args: [], +source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "exportProtocol:on:"] +messageSends: ["ifEmpty:", "stack", "last"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "extensionCategoriesOfPackage:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "pop", +protocol: 'stack', +fn: function (){ var self=this; -var name,map,result; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var peekedValue; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -name=$recv(aPackage)._name(); -result=$recv($OrderedCollection())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv([each,$recv(each)._class()])._do_((function(aClass){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -map=$recv($Dictionary())._new(); -map; -$recv(aClass)._protocolsDo_((function(category,methods){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -$1=$recv(category).__eq("*".__comma(name)); -if($core.assert($1)){ -return $recv(map)._at_put_(category,methods); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)}); -//>>excludeEnd("ctx"); -})); -return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -return $recv(a).__lt_eq(b); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)}); -//>>excludeEnd("ctx"); -})))._collect_((function(category){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); -return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)}); -//>>excludeEnd("ctx"); -}))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$2=result; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +var $1; +peekedValue=self._peek(); +$recv(self._stack())._removeLast(); +$1=peekedValue; +return $1; +}, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result", -referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"], -//>>excludeEnd("ide"); -messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"] +args: [], +source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue", +referencedClasses: [], +messageSends: ["peek", "removeLast", "stack"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "ownCategoriesOfClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "proceed", +protocol: 'interpreting', +fn: function (){ var self=this; -var map; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -map=$recv($Dictionary())._new(); -$recv(aClass)._protocolsDo_((function(each,methods){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(each)._match_("^\x5c*"); -if(!$core.assert($1)){ -return $recv(map)._at_put_(each,methods); -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(a).__lt_eq(b); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)}); -//>>excludeEnd("ctx"); -})))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return self._atEnd(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileFalse_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); +return self._step(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); })); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +return self; +}, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]", -referencedClasses: ["Dictionary", "MethodCategory"], -//>>excludeEnd("ide"); -messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"] +args: [], +source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]", +referencedClasses: [], +messageSends: ["whileFalse:", "atEnd", "step"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "ownCategoriesOfMetaClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "push:", +protocol: 'stack', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._ownCategoriesOfClass_($recv(aClass)._class()); +$1=$recv(self._stack())._add_(anObject); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class", +args: ["anObject"], +source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ownCategoriesOfClass:", "class"] +messageSends: ["add:", "stack"] }), -$globals.ChunkExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "ownMethodProtocolsOfClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "restart", +protocol: 'interpreting', +fn: function (){ var self=this; -function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($ExportMethodProtocol())._name_theClass_(each,aClass); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)}); -//>>excludeEnd("ctx"); +self._node_($recv($recv(self._context())._ast())._nextChild()); +return self; +}, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]", -referencedClasses: ["ExportMethodProtocol"], -//>>excludeEnd("ide"); -messageSends: ["collect:", "ownProtocols", "name:theClass:"] +args: [], +source: "restart\x0a\x09self node: self context ast nextChild", +referencedClasses: [], +messageSends: ["node:", "nextChild", "ast", "context"] }), -$globals.ChunkExporter); - - +$globals.ASTInterpreter); -$core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.)."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "exportDefinitionOf:on:", -protocol: 'output', -fn: function (aClass,aStream){ +selector: "result", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10; -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("$core.addClass("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$2="'".__comma(self._classNameFor_(aClass)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma("', "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$3=self._jsClassNameFor_($recv(aClass)._superclass()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["jsClassNameFor:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$4=$recv(aStream)._nextPutAll_(", ["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$6="'".__comma(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$5=$recv($6).__comma("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(", "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -$recv(aStream)._nextPutAll_("], '"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$7=$recv(aStream)._nextPutAll_(");"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -$9=$recv(aClass)._comment(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["comment"]=1; -//>>excludeEnd("ctx"); -$8=$recv($9)._notEmpty(); -if($core.assert($8)){ -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=11; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(".comment="); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=12; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=13; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(";"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=14; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);"); -$10; +var $2,$1; +$2=self._hasReturned(); +if($core.assert($2)){ +$1=self._returnValue(); +} else { +$1=$recv(self._context())._receiver(); }; -$recv(aStream)._lf(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass", "aStream"], -source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf", +args: [], +source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"] +messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportMetaDefinitionOf:on:", -protocol: 'output', -fn: function (aClass,aStream){ +selector: "returnValue", +protocol: 'accessing', +fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$5,$4,$6,$8,$7; -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$3=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._instanceVariableNames(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instanceVariableNames"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isEmpty(); -if(!$core.assert($1)){ -$5=$recv(aClass)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=2; -//>>excludeEnd("ctx"); -$4=self._jsClassNameFor_($5); -$recv(aStream)._nextPutAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$6=$recv(aStream)._nextPutAll_(".iVarNames = ["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$6; -$recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$8="'".__comma(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$7=$recv($8).__comma("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(aStream)._nextPutAll_(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf())); -}; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@returnValue"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass", "aStream"], -source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","] +args: [], +source: "returnValue\x0a\x09^ returnValue", +referencedClasses: [], +messageSends: [] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportMethod:on:", -protocol: 'output', -fn: function (aMethod,aStream){ +selector: "returnValue:", +protocol: 'accessing', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17; -$recv(aStream)._nextPutAll_("$core.addMethod("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("$core.method({"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -$3=$recv($recv(aMethod)._selector())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=1; -//>>excludeEnd("ctx"); -$2="selector: ".__comma($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$5="protocol: '".__comma($recv(aMethod)._protocol()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$4=$recv($5).__comma("',"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -$7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); -$6=$recv($7).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=5; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=6; -//>>excludeEnd("ctx"); -$10=$recv($recv(aMethod)._arguments())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=2; -//>>excludeEnd("ctx"); -$9="args: ".__comma($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=8; -//>>excludeEnd("ctx"); -$8=$recv($9).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=7; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=7; -//>>excludeEnd("ctx"); -$13=$recv($recv(aMethod)._source())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=3; -//>>excludeEnd("ctx"); -$12="source: ".__comma($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=10; -//>>excludeEnd("ctx"); -$11=$recv($12).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=9; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=8; -//>>excludeEnd("ctx"); -$16=$recv($recv(aMethod)._referencedClasses())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asJavascript"]=4; -//>>excludeEnd("ctx"); -$15="referencedClasses: ".__comma($16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=12; -//>>excludeEnd("ctx"); -$14=$recv($15).__comma(","); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=11; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=9; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=10; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=10; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=11; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=11; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("}),"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=12; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=12; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=13; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(");"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=13; -//>>excludeEnd("ctx"); -$17=$recv(aStream)._lf(); +self["@returnValue"]=anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aMethod", "aStream"], -source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf", +args: ["anObject"], +source: "returnValue: anObject\x0a\x09returnValue := anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"] +messageSends: [] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackage:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "sendMessage:to:superSend:", +protocol: 'private', +fn: function (aMessage,anObject,aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var method; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -self._exportPackagePrologueOf_on_(aPackage,aStream); -self._exportPackageDefinitionOf_on_(aPackage,aStream); -self._exportPackageContextOf_on_(aPackage,aStream); -self._exportPackageImportsOf_on_(aPackage,aStream); -$1=self._exportPackageTransportOf_on_(aPackage,aStream); -$recv($recv(aPackage)._sortedClasses())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self._exportDefinitionOf_on_(each,aStream); -$2=$recv(each)._ownMethods(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["ownMethods"]=1; -//>>excludeEnd("ctx"); -$recv($2)._do_((function(method){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._exportMethod_on_(method,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["exportMethod:on:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["do:"]=2; -//>>excludeEnd("ctx"); -self._exportMetaDefinitionOf_on_(each,aStream); -return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._exportMethod_on_(method,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["exportMethod:on:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["do:"]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -$recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$3,$2,$4,$5,$6,$receiver; +var $early={}; +try { +if(!$core.assert(aBoolean)){ +$1=$recv(aMessage)._sendTo_(anObject); +return $1; +}; +$3=$recv(anObject)._class(); +$ctx1.sendIdx["class"]=1; +$2=$recv($3)._superclass(); +$ctx1.sendIdx["superclass"]=1; +if(($receiver = $2) == null || $receiver.isNil){ +$4=self._messageNotUnderstood_receiver_(aMessage,anObject); +$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1; +return $4; +} else { +$2; +}; +method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._exportMethod_on_(each,aStream); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); +$5=self._messageNotUnderstood_receiver_(aMessage,anObject); +throw $early=[$5]; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); })); -self._exportPackageEpilogueOf_on_(aPackage,aStream); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +$6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments()); +return $6; +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream", +args: ["aMessage", "anObject", "aBoolean"], +source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"] +messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageContextOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "setNonLocalReturnFromContext:", +protocol: 'interpreting', +fn: function (aContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(aStream)._nextPutAll_("$core.packages["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("].innerEval = "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(";"); -$1=$recv(aStream)._lf(); +var $2,$1; +$2=$recv(aContext)._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +$1=$recv($2)._hasReturned(); +if($core.assert($1)){ +self["@returned"]=true; +self["@returned"]; +self._returnValue_($recv($recv(aContext)._interpreter())._returnValue()); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf", +args: ["aContext"], +source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "asJavascript", "name", "lf"] +messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageDefinitionOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "skip", +protocol: 'interpreting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$recv(aStream)._nextPutAll_("$core.addPackage("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$1=$recv("'".__comma($recv(aPackage)._name())).__comma("');"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -$2=$recv(aStream)._lf(); +self._next(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf", +args: [], +source: "skip\x0a\x09self next", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", ",", "name", "lf"] +messageSends: ["next"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageEpilogueOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "stack", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $2,$1,$receiver; +$2=self["@stack"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@stack"]=$recv($OrderedCollection())._new(); +$1=self["@stack"]; +} else { +$1=$2; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)}); +}, +args: [], +source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]", +referencedClasses: ["OrderedCollection"], +messageSends: ["ifNil:", "new"] +}), +$globals.ASTInterpreter); + +$core.addMethod( +$core.method({ +selector: "step", +protocol: 'interpreting', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +self._interpret(); +$1=self._next(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility", +args: [], +source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["interpret", "next"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageImportsOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "stepOver", +protocol: 'interpreting', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1; +self._step(); +$ctx1.sendIdx["step"]=1; +$recv((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("$core.packages["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($recv(aPackage)._name())._asJavascript(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asJavascript"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("].imports = "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv(imports)._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(";"); -$2=$recv(aStream)._lf(); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)}); -//>>excludeEnd("ctx"); +$2=self._node(); +$ctx2.sendIdx["node"]=1; +$1=$recv($2)._isNil(); +return $recv($1)._or_((function(){ +return $core.withContext(function($ctx3) { +return $recv(self._node())._isSteppingNode(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileFalse_((function(){ +return $core.withContext(function($ctx2) { +return self._step(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]", +args: [], +source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"] +messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackagePrologueOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "visit:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $1; +$1=self._hasReturned(); +if(!$core.assert($1)){ +( +$ctx1.supercall = true, +$globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility", +args: ["aNode"], +source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["ifFalse:", "hasReturned", "visit:"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageTransportOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "visitAssignmentNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var poppedValue; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(aStream)._nextPutAll_("$core.packages["); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("].transport = "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(";"); -$1=$recv(aStream)._lf(); +poppedValue=self._pop(); +$ctx1.sendIdx["pop"]=1; +self._pop(); +self._push_(poppedValue); +self._assign_to_($recv(aNode)._left(),poppedValue); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf", +args: ["aNode"], +source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"] +messageSends: ["pop", "push:", "assign:to:", "left"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "jsClassNameFor:", -protocol: 'convenience', -fn: function (aClass){ +selector: "visitBlockNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var block; +function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=$recv(aClass)._isMetaclass(); -if($core.assert($2)){ -$1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -} else { -if(($receiver = aClass) == null || $receiver.isNil){ -$1="null"; -} else { -$1="$globals.".__comma($recv(aClass)._name()); -}; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)}); -//>>excludeEnd("ctx"); +block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode); +self._push_(block); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"] +args: ["aNode"], +source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block", +referencedClasses: ["AIBlockClosure"], +messageSends: ["forContext:node:", "context", "push:"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "ownMethodsOfClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "visitBlockSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(a)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -return $recv($2).__lt_eq($recv(b)._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._reject_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(each)._protocol())._match_("^\x5c*"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)}); -//>>excludeEnd("ctx"); +( +$ctx1.supercall = true, +$globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +self["@forceAtEnd"]=true; +return self; +}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]", +args: ["aNode"], +source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"] +messageSends: ["visitBlockSequenceNode:"] }), -$globals.Exporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "ownMethodsOfMetaClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "visitDynamicArrayNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._ownMethodsOfClass_($recv(aClass)._class()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)}); -//>>excludeEnd("ctx"); +array=[]; +$recv($recv(aNode)._nodes())._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(array)._addFirst_(self._pop()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._push_(array); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class", +args: ["aNode"], +source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ownMethodsOfClass:", "class"] +messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"] }), -$globals.Exporter); - - +$globals.ASTInterpreter); -$core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "amdNamesOfPackages:", -protocol: 'private', -fn: function (anArray){ +selector: "visitDynamicDictionaryNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var keyValueList; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} +function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$1=$recv($recv(anArray)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +keyValueList=$recv($OrderedCollection())._new(); +$recv($recv(aNode)._nodes())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._amdNamespaceOfPackage_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["amdNamespaceOfPackage:"]=1; -//>>excludeEnd("ctx"); -return $recv($2)._notNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(keyValueList)._add_(self._pop()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)}); -//>>excludeEnd("ctx"); +self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed())); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anArray"], -source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"] +args: ["aNode"], +source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)", +referencedClasses: ["OrderedCollection", "HashedCollection"], +messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"] }), -$globals.AmdExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "amdNamespaceOfPackage:", -protocol: 'private', -fn: function (aPackage){ +selector: "visitJSStatementNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -$4=$recv(aPackage)._transport(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["transport"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._type(); -$2=$recv($3).__eq("amd"); -if($core.assert($2)){ -$1=$recv($recv(aPackage)._transport())._namespace(); -} else { -$1=nil; -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)}); -//>>excludeEnd("ctx"); +self["@returned"]=true; +self._returnValue_(self._eval_($recv(aNode)._source())); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]", +args: ["aNode"], +source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"] +messageSends: ["returnValue:", "eval:", "source"] }), -$globals.AmdExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackageEpilogueOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "visitNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +return self; + +}, +args: ["aNode"], +source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22", +referencedClasses: [], +messageSends: [] +}), +$globals.ASTInterpreter); + +$core.addMethod( +$core.method({ +selector: "visitReturnNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(aStream)._nextPutAll_("});"); -$1=$recv(aStream)._lf(); +self["@returned"]=true; +self._returnValue_(self._pop()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf", +args: ["aNode"], +source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nextPutAll:", "lf"] +messageSends: ["returnValue:", "pop"] }), -$globals.AmdExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "exportPackagePrologueOf:on:", -protocol: 'output', -fn: function (aPackage,aStream){ +selector: "visitSendNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var importsForOutput,loadDependencies,pragmaStart,pragmaEnd; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var receiver,args,message,result; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18; -pragmaStart=""; -pragmaEnd=""; -importsForOutput=self._importsForOutput_(aPackage); -loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies()); -$1=$recv(importsForOutput)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -$recv($1)._ifNotEmpty_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +args=$recv($recv(aNode)._arguments())._collect_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$3=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["lf"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$4=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["lf"]=2; -//>>excludeEnd("ctx"); -pragmaStart=$recv($2).__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -pragmaStart; -$6=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["lf"]=3; -//>>excludeEnd("ctx"); -$5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$7=$recv($String())._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["lf"]=4; -//>>excludeEnd("ctx"); -pragmaEnd=$recv($5).__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); -return pragmaEnd; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); +return self._pop(); +$ctx2.sendIdx["pop"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); })); -$recv(aStream)._nextPutAll_("define(\x22"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("/"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($recv(aPackage)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=4; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("\x22, "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=5; -//>>excludeEnd("ctx"); -$13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=7; -//>>excludeEnd("ctx"); -$12=$recv($13).__comma([":2:"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=6; -//>>excludeEnd("ctx"); -$11=$recv($12).__comma(loadDependencies); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=5; -//>>excludeEnd("ctx"); -$10=$recv($11)._asJavascript(); -$9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["replace:with:"]=2; -//>>excludeEnd("ctx"); -$8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["replace:with:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=6; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(", function("); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=7; -//>>excludeEnd("ctx"); -$17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=8; -//>>excludeEnd("ctx"); -$16=$recv($17)._join_(","); -$15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart); -$14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["replace:with:"]=3; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_($14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=8; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("){"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=9; -//>>excludeEnd("ctx"); -$recv(aStream)._lf(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["lf"]=5; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;"); -$18=$recv(aStream)._lf(); +receiver=self._pop(); +message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed()); +result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend()); +$1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv(aNode)._isLastChild())._not(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +if($core.assert($1)){ +self._push_(receiver); +$ctx1.sendIdx["push:"]=1; +} else { +self._push_(result); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aStream"], -source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"] +args: ["aNode"], +source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]", +referencedClasses: [], +messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"] }), -$globals.AmdExporter); +$globals.ASTInterpreter); $core.addMethod( $core.method({ -selector: "importsForOutput:", -protocol: 'private', -fn: function (aPackage){ +selector: "visitSequenceNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var namedImports,anonImports,importVarNames; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -namedImports=[]; -anonImports=[]; -importVarNames=[]; -$recv($recv(aPackage)._imports())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv($recv(aNode)._temps())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(each)._isString(); +return $recv(self._context())._defineLocal_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)}); +}, +args: ["aNode"], +source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]", +referencedClasses: [], +messageSends: ["do:", "temps", "defineLocal:", "context"] +}), +$globals.ASTInterpreter); + +$core.addMethod( +$core.method({ +selector: "visitValueNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +return $core.withContext(function($ctx1) { +self._push_($recv(aNode)._value()); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)}); +}, +args: ["aNode"], +source: "visitValueNode: aNode\x0a\x09self push: aNode value", +referencedClasses: [], +messageSends: ["push:", "value"] +}), +$globals.ASTInterpreter); + +$core.addMethod( +$core.method({ +selector: "visitVariableNode:", +protocol: 'visiting', +fn: function (aNode){ +var self=this; +function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7; +$2=$recv(aNode)._binding(); +$ctx1.sendIdx["binding"]=1; +$1=$recv($2)._isUnknownVar(); if($core.assert($1)){ -return $recv(anonImports)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); +$5=$recv($Platform())._globals(); +$ctx1.sendIdx["globals"]=1; +$6=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=1; +$4=$recv($5)._at_ifAbsent_($6,(function(){ +return $core.withContext(function($ctx2) { +return self._error_("Unknown variable"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +$ctx1.sendIdx["at:ifAbsent:"]=1; +$3=self._push_($4); +$ctx1.sendIdx["push:"]=1; +return $3; +}; +$8=$recv($recv(aNode)._binding())._isInstanceVar(); +if($core.assert($8)){ +$10=self._context(); +$ctx1.sendIdx["context"]=1; +$9=$recv($10)._receiver(); +$11=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=2; +$7=$recv($9)._instVarAt_($11); } else { -$recv(namedImports)._add_($recv(each)._value()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -return $recv(importVarNames)._add_($recv(each)._key()); +$12=self._context(); +$13=$recv(aNode)._value(); +$ctx1.sendIdx["value"]=3; +$7=$recv($12)._localAt_ifAbsent_($13,(function(){ +return $core.withContext(function($ctx2) { +$15=$recv(aNode)._value(); +$ctx2.sendIdx["value"]=4; +$14=$recv($15)._isCapitalized(); +if($core.assert($14)){ +$16=$recv($Smalltalk())._globals(); +$ctx2.sendIdx["globals"]=2; +$17=$recv(aNode)._value(); +$ctx2.sendIdx["value"]=5; +return $recv($16)._at_ifAbsent_($17,(function(){ +return $core.withContext(function($ctx3) { +return $recv($recv($Platform())._globals())._at_($recv(aNode)._value()); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)}); +})); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); })); -$2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports)); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)}); -//>>excludeEnd("ctx"); +}; +self._push_($7); +return self; +}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "importsForOutput: aPackage\x0a\x09\x22Returns an association where key is list of import variables\x0a\x09and value is list of external dependencies, with ones imported as variables\x0a\x09put at the beginning with same order as is in key.\x0a\x09\x0a\x09For example imports:{'jQuery'->'jquery'. 'bootstrap'} would yield\x0a\x09#('jQuery') -> #('jquery' 'bootstrap')\x22\x0a\x09| namedImports anonImports importVarNames |\x0a\x09namedImports := #().\x0a\x09anonImports := #().\x0a\x09importVarNames := #().\x0a\x09aPackage imports do: [ :each | each isString\x0a\x09\x09ifTrue: [ anonImports add: each ]\x0a\x09\x09ifFalse: [ namedImports add: each value.\x0a\x09\x09\x09importVarNames add: each key ]].\x0a\x09^ importVarNames -> (namedImports, anonImports)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","] +args: ["aNode"], +source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])", +referencedClasses: ["Platform", "Smalltalk"], +messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"] }), -$globals.AmdExporter); +$globals.ASTInterpreter); -$core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk"; -//>>excludeEnd("ide"); +$core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter'); +$globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node."; + + +$core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter'); +$globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`"; $core.addMethod( $core.method({ -selector: "last", +selector: "context", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@last"]; +$1=self["@context"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "last\x0a\x09^ last", +source: "context\x0a\x09^ context", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ChunkParser); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "nextChunk", -protocol: 'reading', -fn: function (){ +selector: "context:", +protocol: 'accessing', +fn: function (aContext){ var self=this; -var char,result,chunk; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -var $early={}; -try { -result=""._writeStream(); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -char=$recv(self["@stream"])._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["next"]=1; -//>>excludeEnd("ctx"); -char; -return $recv(char)._notNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(char).__eq("!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -if($core.assert($1)){ -$2=$recv($recv(self["@stream"])._peek()).__eq("!"); -if($core.assert($2)){ -$recv(self["@stream"])._next(); -} else { -self["@last"]=$recv($recv(result)._contents())._trimBoth(); -$3=self["@last"]; -throw $early=[$3]; -}; -}; -return $recv(result)._nextPut_(char); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self["@last"]=nil; -$4=self["@last"]; -return $4; -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)}); -//>>excludeEnd("ctx"); +self["@context"]=aContext; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22", +args: ["aContext"], +source: "context: aContext\x0a\x09context := aContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"] +messageSends: [] }), -$globals.ChunkParser); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "stream:", +selector: "currentNode", protocol: 'accessing', -fn: function (aStream){ +fn: function (){ var self=this; -self["@stream"]=aStream; -return self; +var $1; +$1=self["@currentNode"]; +return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStream"], -source: "stream: aStream\x0a\x09stream := aStream", +args: [], +source: "currentNode\x0a\x09^ currentNode", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ChunkParser); - +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "on:", -protocol: 'instance creation', -fn: function (aStream){ +selector: "increaseIndex", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._new())._stream_(aStream); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)}); -//>>excludeEnd("ctx"); +self["@index"]=$recv(self._index()).__plus((1)); +return self; +}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStream"], -source: "on: aStream\x0a\x09^ self new stream: aStream", +args: [], +source: "increaseIndex\x0a\x09index := self index + 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["stream:", "new"] +messageSends: ["+", "index"] }), -$globals.ChunkParser.klass); - +$globals.ASTPCNodeVisitor); -$core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "methods", +selector: "index", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(a)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -return $recv($2).__lt_eq($recv(b)._selector()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $2,$1,$receiver; +$2=self["@index"]; +if(($receiver = $2) == null || $receiver.isNil){ +self["@index"]=(0); +$1=self["@index"]; +} else { +$1=$2; +}; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]", +source: "index\x0a\x09^ index ifNil: [ index := 0 ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"] +messageSends: ["ifNil:"] }), -$globals.ExportMethodProtocol); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "name", +selector: "selector", protocol: 'accessing', fn: function (){ var self=this; var $1; -$1=self["@name"]; +$1=self["@selector"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "name\x0a\x09^ name", +source: "selector\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ExportMethodProtocol); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "name:", +selector: "selector:", protocol: 'accessing', fn: function (aString){ var self=this; -self["@name"]=aString; +self["@selector"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "name: aString\x0a\x09name := aString", +source: "selector: aString\x0a\x09selector := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ExportMethodProtocol); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "theClass", -protocol: 'accessing', -fn: function (){ +selector: "visitJSStatementNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -var $1; -$1=self["@theClass"]; -return $1; +self["@currentNode"]=aNode; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "theClass\x0a\x09^ theClass", +args: ["aNode"], +source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ExportMethodProtocol); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "theClass:", -protocol: 'accessing', -fn: function (aClass){ +selector: "visitSendNode:", +protocol: 'visiting', +fn: function (aNode){ var self=this; -self["@theClass"]=aClass; +var sendIndex; +return $core.withContext(function($ctx1) { +var $1,$2,$4,$3,$5; +$1=self._context(); +$2=self._selector(); +$ctx1.sendIdx["selector"]=1; +sendIndex=$recv($1)._sendIndexAt_($2); +( +$ctx1.supercall = true, +$globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode])); +$ctx1.supercall = false; +$4=self._selector(); +$ctx1.sendIdx["selector"]=2; +$3=$recv($4).__eq($recv(aNode)._selector()); +$ctx1.sendIdx["="]=1; +if($core.assert($3)){ +$5=$recv(self._index()).__eq(sendIndex); +if($core.assert($5)){ +self["@currentNode"]=aNode; +self["@currentNode"]; +}; +self._increaseIndex(); +}; return self; - +}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "theClass: aClass\x0a\x09theClass := aClass", +args: ["aNode"], +source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"] }), -$globals.ExportMethodProtocol); +$globals.ASTPCNodeVisitor); $core.addMethod( $core.method({ -selector: "name:theClass:", -protocol: 'instance creation', -fn: function (aString,aClass){ +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._name_(aString); -$recv($2)._theClass_(aClass); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aClass"], -source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself", +args: [], +source: "isSteppingNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["name:", "new", "theClass:", "yourself"] +messageSends: [] }), -$globals.ExportMethodProtocol.klass); - +$globals.AssignmentNode); -$core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString"; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "import:", -protocol: 'fileIn', -fn: function (aStream){ +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', +fn: function (){ var self=this; -var chunk,result,parser,lastEmpty; -function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)} -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -parser=$recv($ChunkParser())._on_(aStream); -lastEmpty=false; -self["@lastSection"]="n/a, not started"; -self["@lastChunk"]=nil; -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -chunk=$recv(parser)._nextChunk(); -chunk; -return $recv(chunk)._isNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$1=$recv(chunk)._isEmpty(); -if($core.assert($1)){ -lastEmpty=true; -return lastEmpty; -} else { -self["@lastSection"]=chunk; -self["@lastSection"]; -result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk); -result; -$2=lastEmpty; -if($core.assert($2)){ -lastEmpty=false; -lastEmpty; -return $recv(result)._scanFrom_(parser); -}; -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -self["@lastSection"]="n/a, finished"; -return self["@lastSection"]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(e){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -self["@lastChunk"]=$recv(parser)._last(); -self["@lastChunk"]; -return $recv(e)._resignal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStream"], -source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].", -referencedClasses: ["ChunkParser", "Compiler", "Error"], -//>>excludeEnd("ide"); -messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"] +args: [], +source: "isSteppingNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.Importer); +$globals.BlockNode); $core.addMethod( $core.method({ -selector: "lastChunk", -protocol: 'accessing', +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', fn: function (){ var self=this; -var $1; -$1=self["@lastChunk"]; -return $1; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "lastChunk\x0a\x09^ lastChunk", +source: "isSteppingNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.Importer); +$globals.DynamicArrayNode); $core.addMethod( $core.method({ -selector: "lastSection", -protocol: 'accessing', +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', fn: function (){ var self=this; -var $1; -$1=self["@lastSection"]; -return $1; +return true; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "lastSection\x0a\x09^ lastSection", +source: "isSteppingNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.Importer); - - +$globals.DynamicDictionaryNode); -$core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "ajaxPutAt:data:onSuccess:onError:", -protocol: 'private', -fn: function (aURL,aString,aBlock,anotherBlock){ +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._ajax_($globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock])); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aURL", "aString", "aBlock", "anotherBlock"], -source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'success' -> aBlock.\x0a\x09\x09\x09'error' -> anotherBlock\x0a\x09\x09}", +args: [], +source: "isSteppingNode\x0a\x09^ true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ajax:"] +messageSends: [] }), -$globals.PackageHandler); +$globals.JSStatementNode); $core.addMethod( $core.method({ -selector: "chunkContentsFor:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', +fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($String())._streamContents_((function(str){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +return false; + +}, +args: [], +source: "isSteppingNode\x0a\x09^ false", +referencedClasses: [], +messageSends: [] +}), +$globals.Node); + +$core.addMethod( +$core.method({ +selector: "isSteppingNode", +protocol: '*Compiler-Interpreter', +fn: function (){ +var self=this; +return true; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"] +args: [], +source: "isSteppingNode\x0a\x09^ true", +referencedClasses: [], +messageSends: [] }), -$globals.PackageHandler); +$globals.SendNode); + +}); + +define('amber/lang',[ + './helpers', // pre-fetch, dep of ./deploy + './deploy', + './parser', + // --- packages for the Amber reflection begin here --- + 'amber_core/Platform-ImportExport', + 'amber_core/Compiler-Exceptions', + 'amber_core/Compiler-Core', + 'amber_core/Compiler-AST', + 'amber_core/Compiler-Semantic', + 'amber_core/Compiler-IR', + 'amber_core/Compiler-Inlining', + 'amber_core/Compiler-Interpreter' + // --- packages for the Amber reflection end here --- +], function (amber) { return amber; }); +define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('SUnit'); +$core.packages["SUnit"].innerEval = function (expr) { return eval(expr); }; +$core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"}; + +$core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit'); +$globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run."; $core.addMethod( $core.method({ -selector: "chunkExporter", -protocol: 'factory', +selector: "result", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._chunkExporterClass())._new(); +$1=self["@result"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "chunkExporter\x0a\x09^ self chunkExporterClass new", +source: "result\x0a\x09^ result", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "chunkExporterClass"] +messageSends: [] }), -$globals.PackageHandler); +$globals.ResultAnnouncement); $core.addMethod( $core.method({ -selector: "chunkExporterClass", +selector: "result:", protocol: 'accessing', -fn: function (){ +fn: function (aTestResult){ var self=this; -function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)} -return $ChunkExporter(); +self["@result"]=aTestResult; +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "chunkExporterClass\x0a\x09^ ChunkExporter", -referencedClasses: ["ChunkExporter"], -//>>excludeEnd("ide"); +args: ["aTestResult"], +source: "result: aTestResult\x0a\x09result := aTestResult", +referencedClasses: [], messageSends: [] }), -$globals.PackageHandler); +$globals.ResultAnnouncement); + + +$core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit'); +$globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate."; $core.addMethod( $core.method({ -selector: "commit:", -protocol: 'committing', -fn: function (aPackage){ +selector: "assert:", +protocol: 'testing', +fn: function (aBoolean){ var self=this; -function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -self._commit_onSuccess_onError_(aPackage,(function(){ - -}),(function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv($PackageCommitError())._new(); -$2=$1; -$3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($2)._messageText_($3); -$4=$recv($1)._signal(); -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); +self._assert_description_(aBoolean,"Assertion failed"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]", -referencedClasses: ["PackageCommitError"], -//>>excludeEnd("ide"); -messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"] +args: ["aBoolean"], +source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'", +referencedClasses: [], +messageSends: ["assert:description:"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commit:onSuccess:onError:", -protocol: 'committing', -fn: function (aPackage,aBlock,anotherBlock){ +selector: "assert:description:", +protocol: 'testing', +fn: function (aBoolean,aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$recv(aPackage)._beClean(); -return $recv(aBlock)._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}),anotherBlock); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),anotherBlock); +if(!$core.assert(aBoolean)){ +self._signalFailure_(aString); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aBlock", "anotherBlock"], -source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock", +args: ["aBoolean", "aString"], +source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"] +messageSends: ["ifFalse:", "signalFailure:"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commitJsFileFor:onSuccess:onError:", -protocol: 'committing', -fn: function (aPackage,aBlock,anotherBlock){ +selector: "assert:equals:", +protocol: 'testing', +fn: function (actual,expected){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$6,$5,$4,$3,$1; +$2=$recv(actual).__eq(expected); +$6=$recv(expected)._printString(); +$ctx1.sendIdx["printString"]=1; +$5="Expected: ".__comma($6); +$4=$recv($5).__comma(" but was: "); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma(".js"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$3=$recv($4).__comma($recv(actual)._printString()); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +$1=self._assert_description_($2,$3); +return $1; +}, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aBlock", "anotherBlock"], -source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", +args: ["actual", "expected"], +source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"] +messageSends: ["assert:description:", "=", ",", "printString"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commitPathJsFor:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "async:", +protocol: 'async', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var c; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +var $2,$1; +self._errorIfNotAsync_("#async"); +c=self["@context"]; +$1=(function(){ +return $core.withContext(function($ctx2) { +$2=self._isAsync(); +if($core.assert($2)){ +return $recv(c)._execute_(aBlock); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}); +return $1; +}, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility", +args: ["aBlock"], +source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commitPathStFor:", +selector: "context:", protocol: 'accessing', -fn: function (aPackage){ +fn: function (aRunningTestContext){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self["@context"]=aRunningTestContext; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility", +args: ["aRunningTestContext"], +source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: [] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commitStFileFor:onSuccess:onError:", -protocol: 'committing', -fn: function (aPackage,aBlock,anotherBlock){ +selector: "deny:", +protocol: 'testing', +fn: function (aBoolean){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma(".st"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock); +self._assert_($recv(aBoolean)._not()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage", "aBlock", "anotherBlock"], -source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", +args: ["aBoolean"], +source: "deny: aBoolean\x0a\x09self assert: aBoolean not", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"] +messageSends: ["assert:", "not"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "contentsFor:", -protocol: 'accessing', -fn: function (aPackage){ +selector: "errorIfNotAsync:", +protocol: 'error handling', +fn: function (aString){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv($String())._streamContents_((function(str){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._exporter())._exportPackage_on_(aPackage,str); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +$1=self._isAsync(); +if(!$core.assert($1)){ +self._error_($recv(aString).__comma(" used without prior #timeout:")); +}; +return self; +}, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["streamContents:", "exportPackage:on:", "exporter"] +args: ["aString"], +source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]", +referencedClasses: [], +messageSends: ["ifFalse:", "isAsync", "error:", ","] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "exporter", -protocol: 'factory', +selector: "finished", +protocol: 'async', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._exporterClass())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +self._errorIfNotAsync_("#finished"); +self["@asyncTimeout"]=nil; +return self; +}, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "exporter\x0a\x09^ self exporterClass new", +source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "exporterClass"] +messageSends: ["errorIfNotAsync:"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "exporterClass", -protocol: 'accessing', +selector: "isAsync", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self["@asyncTimeout"])._notNil(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "exporterClass\x0a\x09self subclassResponsibility", +source: "isAsync\x0a\x09^ asyncTimeout notNil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["notNil"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "load:", -protocol: 'loading', -fn: function (aPackage){ +selector: "performTest", +protocol: 'running', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self["@asyncTimeout"]=nil; +self._perform_(self._selector()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "load: aPackage\x0a\x09self subclassResponsibility", +args: [], +source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["perform:", "selector"] }), -$globals.PackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "onCommitError:", -protocol: 'error handling', -fn: function (anError){ +selector: "runCase", +protocol: 'running', +fn: function (){ var self=this; -function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$1=$recv($PackageCommitError())._new(); -$2=$1; -$3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$recv($2)._messageText_($3); -$4=$recv($1)._signal(); +$recv($recv($TestContext())._testCase_(self))._start(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anError"], -source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal", -referencedClasses: ["PackageCommitError"], -//>>excludeEnd("ide"); -messageSends: ["messageText:", "new", ",", "responseText", "signal"] +args: [], +source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start", +referencedClasses: ["TestContext"], +messageSends: ["start", "testCase:"] }), -$globals.PackageHandler); - - +$globals.TestCase); -$core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "commitPathJsFor:", +selector: "selector", protocol: 'accessing', -fn: function (aPackage){ +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=self._toUrl_(self._namespaceFor_(aPackage)); +$1=self["@testSelector"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)", +args: [], +source: "selector\x0a\x09^ testSelector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["toUrl:", "namespaceFor:"] +messageSends: [] }), -$globals.AmdPackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commitPathStFor:", +selector: "setTestSelector:", protocol: 'accessing', -fn: function (aPackage){ +fn: function (aSelector){ var self=this; -var path,pathWithout; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2; -$1=$recv(self._namespaceFor_(aPackage)).__comma("/_source"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -path=self._toUrl_($1); -pathWithout=self._commitPathJsFor_(aPackage); -$3=$recv(path).__eq($recv(pathWithout).__comma("/_source")); -if($core.assert($3)){ -$2=pathWithout; -} else { -$2=path; -}; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)}); -//>>excludeEnd("ctx"); +self["@testSelector"]=aSelector; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]", +args: ["aSelector"], +source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="] +messageSends: [] }), -$globals.AmdPackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "exporterClass", -protocol: 'accessing', +selector: "setUp", +protocol: 'running', fn: function (){ var self=this; -function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)} -return $AmdExporter(); +return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "exporterClass\x0a\x09^ AmdExporter", -referencedClasses: ["AmdExporter"], -//>>excludeEnd("ide"); +source: "setUp", +referencedClasses: [], messageSends: [] }), -$globals.AmdPackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "load:", -protocol: 'loading', -fn: function (aPackage){ +selector: "should:", +protocol: 'testing', +fn: function (aBlock){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$receiver; -$1=$recv($Smalltalk())._amdRequire(); -if(($receiver = $1) == null || $receiver.isNil){ -self._error_("AMD loader not present"); -} else { -var require; -require=$receiver; -$3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$2=$recv($Array())._with_($3); -$recv(require)._value_($2); -}; +self._assert_($recv(aBlock)._value()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]", -referencedClasses: ["Smalltalk", "Array"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"] -}), -$globals.AmdPackageHandler); - -$core.addMethod( -$core.method({ -selector: "namespaceFor:", -protocol: 'committing', -fn: function (aPackage){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(aPackage)._transport())._namespace(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace", +args: ["aBlock"], +source: "should: aBlock\x0a\x09self assert: aBlock value", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["namespace", "transport"] +messageSends: ["assert:", "value"] }), -$globals.AmdPackageHandler); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "toUrl:", -protocol: 'private', -fn: function (aString){ +selector: "should:raise:", +protocol: 'testing', +fn: function (aBlock,anExceptionClass){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=$recv($Smalltalk())._amdRequire(); -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._error_("AMD loader not present"); -} else { -var require; -require=$receiver; -$1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString); -}; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)}); -//>>excludeEnd("ctx"); +self._assert_($recv((function(){ +return $core.withContext(function($ctx2) { +$recv(aBlock)._value(); +return false; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_(anExceptionClass,(function(ex){ +return true; + +}))); +return self; +}, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"] +args: ["aBlock", "anExceptionClass"], +source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])", +referencedClasses: [], +messageSends: ["assert:", "on:do:", "value"] }), -$globals.AmdPackageHandler); - +$globals.TestCase); $core.addMethod( $core.method({ -selector: "defaultNamespace", -protocol: 'commit paths', -fn: function (){ +selector: "shouldnt:raise:", +protocol: 'testing', +fn: function (aBlock,anExceptionClass){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._defaultAmdNamespace(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)}); -//>>excludeEnd("ctx"); +self._assert_($recv((function(){ +return $core.withContext(function($ctx2) { +$recv(aBlock)._value(); +return true; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_(anExceptionClass,(function(ex){ +return false; + +}))); +return self; +}, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["defaultAmdNamespace"] +args: ["aBlock", "anExceptionClass"], +source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])", +referencedClasses: [], +messageSends: ["assert:", "on:do:", "value"] }), -$globals.AmdPackageHandler.klass); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "defaultNamespace:", -protocol: 'commit paths', +selector: "signalFailure:", +protocol: 'private', fn: function (aString){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($Smalltalk())._defaultAmdNamespace_(aString); +var $1,$2; +$1=$recv($TestFailure())._new(); +$recv($1)._messageText_(aString); +$2=$recv($1)._signal(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], -source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["defaultAmdNamespace:"] +source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal", +referencedClasses: ["TestFailure"], +messageSends: ["messageText:", "new", "signal"] }), -$globals.AmdPackageHandler.klass); - +$globals.TestCase); -$core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "asJSON", -protocol: 'converting', +selector: "tearDown", +protocol: 'running', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$globals.HashedCollection._newFromPairs_(["type",self._type()]); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "asJSON\x0a\x09^ #{ 'type' -> self type }", +source: "tearDown", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["type"] +messageSends: [] }), -$globals.PackageTransport); +$globals.TestCase); $core.addMethod( $core.method({ -selector: "commit", -protocol: 'committing', -fn: function (){ +selector: "timeout:", +protocol: 'async', +fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._commitHandler())._commit_(self._package()); +var $1,$receiver; +$1=self["@asyncTimeout"]; +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +$recv(self["@asyncTimeout"])._clearTimeout(); +}; +self["@asyncTimeout"]=(0); +self["@asyncTimeout"]=$recv(self._async_((function(){ +return $core.withContext(function($ctx2) { +return self._assert_description_(false,"SUnit grace time exhausted"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})))._valueWithTimeout_(aNumber); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "commit\x0a\x09self commitHandler commit: self package", +args: ["aNumber"], +source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["commit:", "commitHandler", "package"] +messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"] }), -$globals.PackageTransport); +$globals.TestCase); + $core.addMethod( $core.method({ -selector: "commitHandler", -protocol: 'factory', +selector: "allTestSelectors", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var selectors; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._commitHandlerClass())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +var $1,$2; +selectors=self._testSelectors(); +$1=self._shouldInheritSelectors(); +if($core.assert($1)){ +$recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors()); +}; +$2=selectors; +return $2; +}, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "commitHandler\x0a\x09^ self commitHandlerClass new", +source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "commitHandlerClass"] +messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "commitHandlerClass", +selector: "buildSuite", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._allTestSelectors())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return self._selector_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "commitHandlerClass\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] -}), -$globals.PackageTransport); - -$core.addMethod( -$core.method({ -selector: "commitOnSuccess:onError:", -protocol: 'committing', -fn: function (aBlock,anotherBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock", "anotherBlock"], -source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock", +source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"] +messageSends: ["collect:", "allTestSelectors", "selector:"] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "definition", +selector: "classTag", protocol: 'accessing', fn: function (){ var self=this; -return ""; +return "test"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "definition\x0a\x09^ ''", +source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'test'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "load", -protocol: 'loading', +selector: "isAbstract", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._commitHandler())._load_(self._package()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._name()).__eq("TestCase"); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "load\x0a\x09self commitHandler load: self package", +source: "isAbstract\x0a\x09^ self name = 'TestCase'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["load:", "commitHandler", "package"] +messageSends: ["=", "name"] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "package", +selector: "lookupHierarchyRoot", protocol: 'accessing', fn: function (){ var self=this; -var $1; -$1=self["@package"]; -return $1; +function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)} +return $TestCase(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "package\x0a\x09^ package", -referencedClasses: [], -//>>excludeEnd("ide"); +source: "lookupHierarchyRoot\x0a\x09^ TestCase", +referencedClasses: ["TestCase"], messageSends: [] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "package:", +selector: "selector:", protocol: 'accessing', -fn: function (aPackage){ +fn: function (aSelector){ var self=this; -self["@package"]=aPackage; -return self; - +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._new(); +$recv($2)._setTestSelector_(aSelector); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackage"], -source: "package: aPackage\x0a\x09package := aPackage", +args: ["aSelector"], +source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["setTestSelector:", "new", "yourself"] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "setupFromJson:", -protocol: 'initialization', -fn: function (anObject){ +selector: "shouldInheritSelectors", +protocol: 'testing', +fn: function (){ var self=this; -return self; - +return $core.withContext(function($ctx1) { +var $1; +$1=self.__tild_eq(self._lookupHierarchyRoot()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22", +args: [], +source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["~=", "lookupHierarchyRoot"] }), -$globals.PackageTransport); +$globals.TestCase.klass); $core.addMethod( $core.method({ -selector: "type", +selector: "testSelectors", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._class())._type(); +$1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._match_("^test"); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "type\x0a\x09^ self class type", +source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["type", "class"] +messageSends: ["select:", "keys", "methodDictionary", "match:"] }), -$globals.PackageTransport); +$globals.TestCase.klass); -$globals.PackageTransport.klass.iVarNames = ['registry']; +$core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit'); +$globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario)."; $core.addMethod( $core.method({ -selector: "classRegisteredFor:", -protocol: 'accessing', -fn: function (aString){ +selector: "execute:", +protocol: 'running', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var failed; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self["@registry"])._at_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); +var $1,$2; +$recv(self["@testCase"])._context_(self); +$ctx1.sendIdx["context:"]=1; +$recv((function(){ +return $core.withContext(function($ctx2) { +failed=true; +failed; +$recv(aBlock)._value(); +failed=false; +return failed; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._ensure_((function(){ +return $core.withContext(function($ctx2) { +$recv(self["@testCase"])._context_(nil); +$1=$recv(failed)._and_((function(){ +return $core.withContext(function($ctx3) { +return $recv(self["@testCase"])._isAsync(); +$ctx3.sendIdx["isAsync"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +if($core.assert($1)){ +$recv(self["@testCase"])._finished(); +}; +$2=$recv(self["@testCase"])._isAsync(); +if(!$core.assert($2)){ +return $recv(self["@testCase"])._tearDown(); +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "classRegisteredFor: aString\x0a\x09^ registry at: aString", +args: ["aBlock"], +source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:"] +messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"] }), -$globals.PackageTransport.klass); +$globals.TestContext); $core.addMethod( $core.method({ -selector: "defaultType", -protocol: 'accessing', +selector: "start", +protocol: 'running', fn: function (){ var self=this; -function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($AmdPackageTransport())._type(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); +self._execute_((function(){ +return $core.withContext(function($ctx2) { +$recv(self["@testCase"])._setUp(); +return $recv(self["@testCase"])._performTest(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "defaultType\x0a\x09^ AmdPackageTransport type", -referencedClasses: ["AmdPackageTransport"], -//>>excludeEnd("ide"); -messageSends: ["type"] +source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]", +referencedClasses: [], +messageSends: ["execute:", "setUp", "performTest"] }), -$globals.PackageTransport.klass); +$globals.TestContext); $core.addMethod( $core.method({ -selector: "for:", -protocol: 'instance creation', -fn: function (aString){ +selector: "testCase:", +protocol: 'accessing', +fn: function (aTestCase){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._classRegisteredFor_(aString))._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); +self["@testCase"]=aTestCase; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new", +args: ["aTestCase"], +source: "testCase: aTestCase\x0a\x09testCase := aTestCase", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "classRegisteredFor:"] +messageSends: [] }), -$globals.PackageTransport.klass); +$globals.TestContext); + $core.addMethod( $core.method({ -selector: "fromJson:", +selector: "testCase:", protocol: 'instance creation', -fn: function (anObject){ +fn: function (aTestCase){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$4,$2,$receiver; -if(($receiver = anObject) == null || $receiver.isNil){ -$1=self._for_(self._defaultType()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["for:"]=1; -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=self._new(); +$recv($2)._testCase_(aTestCase); +$3=$recv($2)._yourself(); +$1=$3; return $1; -} else { -anObject; -}; -$3=self._for_($recv(anObject)._type()); -$recv($3)._setupFromJson_(anObject); -$4=$recv($3)._yourself(); -$2=$4; -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself", +args: ["aTestCase"], +source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"] +messageSends: ["testCase:", "new", "yourself"] }), -$globals.PackageTransport.klass); +$globals.TestContext.klass); + +$core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit'); +$globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`."; $core.addMethod( $core.method({ -selector: "initialize", -protocol: 'initialization', -fn: function (){ +selector: "execute:", +protocol: 'running', +fn: function (aBlock){ var self=this; -function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$1=self.__eq_eq($PackageTransport()); -if($core.assert($1)){ -self["@registry"]=$globals.HashedCollection._newFromPairs_([]); -self["@registry"]; -} else { -self._register(); +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._withErrorReporting_((function(){ +return $core.withContext(function($ctx3) { +return ( +$ctx3.supercall = true, +$globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock])); +$ctx3.supercall = false; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._ensure_((function(){ +return $core.withContext(function($ctx2) { +$1=$recv(self["@testCase"])._isAsync(); +if(!$core.assert($1)){ +$recv(self["@result"])._increaseRuns(); +return $recv(self["@finished"])._value(); }; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]", -referencedClasses: ["PackageTransport"], -//>>excludeEnd("ide"); -messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"] +args: ["aBlock"], +source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]", +referencedClasses: [], +messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"] }), -$globals.PackageTransport.klass); +$globals.ReportingTestContext); $core.addMethod( $core.method({ -selector: "register", -protocol: 'registration', -fn: function (){ +selector: "finished:", +protocol: 'accessing', +fn: function (aBlock){ var self=this; -function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($PackageTransport())._register_(self); +self["@finished"]=aBlock; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "register\x0a\x09PackageTransport register: self", -referencedClasses: ["PackageTransport"], -//>>excludeEnd("ide"); -messageSends: ["register:"] +args: ["aBlock"], +source: "finished: aBlock\x0a\x09finished := aBlock", +referencedClasses: [], +messageSends: [] }), -$globals.PackageTransport.klass); +$globals.ReportingTestContext); $core.addMethod( $core.method({ -selector: "register:", -protocol: 'registration', -fn: function (aClass){ +selector: "result:", +protocol: 'accessing', +fn: function (aTestResult){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=$recv(aClass)._type(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["type"]=1; -//>>excludeEnd("ctx"); -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -$recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass); -}; +self["@result"]=aTestResult; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aClass"], -source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]", +args: ["aTestResult"], +source: "result: aTestResult\x0a\x09result := aTestResult", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "type", "at:put:"] +messageSends: [] }), -$globals.PackageTransport.klass); +$globals.ReportingTestContext); $core.addMethod( $core.method({ -selector: "type", -protocol: 'accessing', -fn: function (){ +selector: "withErrorReporting:", +protocol: 'private', +fn: function (aBlock){ var self=this; -return nil; - +function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $core.withContext(function($ctx1) { +$recv((function(){ +return $core.withContext(function($ctx2) { +return $recv(aBlock)._on_do_($TestFailure(),(function(ex){ +return $core.withContext(function($ctx3) { +return $recv(self["@result"])._addFailure_(self["@testCase"]); +}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(ex){ +return $core.withContext(function($ctx2) { +return $recv(self["@result"])._addError_(self["@testCase"]); +}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)}); +})); +$ctx1.sendIdx["on:do:"]=1; +return self; +}, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: ["aBlock"], +source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]", +referencedClasses: ["TestFailure", "Error"], +messageSends: ["on:do:", "addFailure:", "addError:"] }), -$globals.PackageTransport.klass); +$globals.ReportingTestContext); -$core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "asJSON", -protocol: 'converting', -fn: function (){ +selector: "testCase:result:finished:", +protocol: 'instance creation', +fn: function (aTestCase,aTestResult,aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; $2=( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase])); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv($2)._at_put_("amdNamespace",self._namespace()); +$recv($2)._result_(aTestResult); +$recv($2)._finished_(aBlock); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself", +args: ["aTestCase", "aTestResult", "aBlock"], +source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "asJSON", "namespace", "yourself"] +messageSends: ["result:", "testCase:", "finished:", "yourself"] }), -$globals.AmdPackageTransport); +$globals.ReportingTestContext.klass); + + +$core.addClass('TestFailure', $globals.Error, [], 'SUnit'); +$globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds."; + +$core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit'); +$globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce"; $core.addMethod( $core.method({ -selector: "commitHandlerClass", +selector: "addError:", protocol: 'accessing', -fn: function (){ +fn: function (anError){ var self=this; -function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)} -return $AmdPackageHandler(); - +return $core.withContext(function($ctx1) { +$recv(self._errors())._add_(anError); +return self; +}, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "commitHandlerClass\x0a\x09^ AmdPackageHandler", -referencedClasses: ["AmdPackageHandler"], -//>>excludeEnd("ide"); -messageSends: [] +args: ["anError"], +source: "addError: anError\x0a\x09self errors add: anError", +referencedClasses: [], +messageSends: ["add:", "errors"] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "defaultNamespace", -protocol: 'defaults', -fn: function (){ +selector: "addFailure:", +protocol: 'accessing', +fn: function (aFailure){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._defaultAmdNamespace(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); +$recv(self._failures())._add_(aFailure); +return self; +}, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["defaultAmdNamespace"] +args: ["aFailure"], +source: "addFailure: aFailure\x0a\x09self failures add: aFailure", +referencedClasses: [], +messageSends: ["add:", "failures"] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "definition", +selector: "errors", protocol: 'accessing', fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1; -$1=$recv($String())._streamContents_((function(stream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(stream)._nextPutAll_($recv(self._class())._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(stream)._nextPutAll_(" namespace: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$3=$recv("'".__comma(self._namespace())).__comma("'"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$2=$recv(stream)._nextPutAll_($3); -return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1; +$1=self["@errors"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"] +source: "errors\x0a\x09^ errors", +referencedClasses: [], +messageSends: [] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "namespace", +selector: "failures", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$receiver; -$2=self["@namespace"]; -if(($receiver = $2) == null || $receiver.isNil){ -$1=self._defaultNamespace(); -} else { -$1=$2; -}; +var $1; +$1=self["@failures"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]", +source: "failures\x0a\x09^ failures", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["ifNil:", "defaultNamespace"] +messageSends: [] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "namespace:", +selector: "increaseRuns", protocol: 'accessing', -fn: function (aString){ +fn: function (){ var self=this; -self["@namespace"]=aString; +return $core.withContext(function($ctx1) { +self["@runs"]=$recv(self["@runs"]).__plus((1)); return self; - +}, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "namespace: aString\x0a\x09namespace := aString", +args: [], +source: "increaseRuns\x0a\x09runs := runs + 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["+"] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "printOn:", -protocol: 'printing', -fn: function (aStream){ +selector: "initialize", +protocol: 'initialization', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)} +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), [])); $ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aStream)._nextPutAll_(" (AMD Namespace: "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_(self._namespace()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPutAll:"]=2; -//>>excludeEnd("ctx"); -$1=$recv(aStream)._nextPutAll_(")"); +self["@timestamp"]=$recv($Date())._now(); +self["@runs"]=(0); +self["@errors"]=$recv($Array())._new(); +$ctx1.sendIdx["new"]=1; +self["@failures"]=$recv($Array())._new(); +self["@total"]=(0); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aStream"], -source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["printOn:", "nextPutAll:", "namespace"] +args: [], +source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0", +referencedClasses: ["Date", "Array"], +messageSends: ["initialize", "now", "new"] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "setPath:", -protocol: 'actions', -fn: function (aString){ +selector: "nextRunDo:", +protocol: 'running', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])])); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); +var $3,$2,$1; +$3=self._runs(); +$ctx1.sendIdx["runs"]=1; +$2=$recv($3).__eq_eq(self._total()); +if(!$core.assert($2)){ +$1=$recv(aBlock)._value_($recv(self._runs()).__plus((1))); +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.", +args: ["aBlock"], +source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:", "basicAt:", "namespace"] +messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"] }), -$globals.AmdPackageTransport); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "setupFromJson:", -protocol: 'initialization', -fn: function (anObject){ +selector: "runCase:", +protocol: 'running', +fn: function (aTestCase){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._namespace_($recv(anObject)._at_("amdNamespace")); +$recv((function(){ +return $core.withContext(function($ctx2) { +return $recv((function(){ +return $core.withContext(function($ctx3) { +self._increaseRuns(); +return $recv(aTestCase)._runCase(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}))._on_do_($TestFailure(),(function(ex){ +return $core.withContext(function($ctx3) { +return self._addFailure_(aTestCase); +}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(ex){ +return $core.withContext(function($ctx2) { +return self._addError_(aTestCase); +}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)}); +})); +$ctx1.sendIdx["on:do:"]=1; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["namespace:", "at:"] +args: ["aTestCase"], +source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]", +referencedClasses: ["TestFailure", "Error"], +messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"] }), -$globals.AmdPackageTransport); - +$globals.TestResult); $core.addMethod( $core.method({ -selector: "namespace:", -protocol: 'instance creation', -fn: function (aString){ +selector: "runs", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._new(); -$recv($2)._namespace_(aString); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=self["@runs"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself", +args: [], +source: "runs\x0a\x09^ runs", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["namespace:", "new", "yourself"] +messageSends: [] }), -$globals.AmdPackageTransport.klass); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "type", +selector: "status", protocol: 'accessing', fn: function (){ var self=this; -return "amd"; - +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv(self._errors())._isEmpty(); +$ctx1.sendIdx["isEmpty"]=1; +if($core.assert($2)){ +$3=$recv(self._failures())._isEmpty(); +if($core.assert($3)){ +$1="success"; +} else { +$1="failure"; +}; +} else { +$1="error"; +}; +return $1; +}, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "type\x0a\x09^ 'amd'", +source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"] }), -$globals.AmdPackageTransport.klass); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "commit", -protocol: '*Platform-ImportExport', +selector: "timestamp", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._transport())._commit(); +$1=self["@timestamp"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "commit\x0a\x09^ self transport commit", +source: "timestamp\x0a\x09^ timestamp", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["commit", "transport"] +messageSends: [] }), -$globals.Package); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "load", -protocol: '*Platform-ImportExport', +selector: "total", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv(self._transport())._load(); +$1=self["@total"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "load\x0a\x09^ self transport load", +source: "total\x0a\x09^ total", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["load", "transport"] +messageSends: [] }), -$globals.Package); +$globals.TestResult); $core.addMethod( $core.method({ -selector: "loadFromNamespace:", -protocol: '*Platform-ImportExport', -fn: function (aString){ +selector: "total:", +protocol: 'accessing', +fn: function (aNumber){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._transport(); -$recv($2)._namespace_(aString); -$3=$recv($2)._load(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)}); -//>>excludeEnd("ctx"); +self["@total"]=aNumber; +return self; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load", +args: ["aNumber"], +source: "total: aNumber\x0a\x09total := aNumber", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["namespace:", "transport", "load"] +messageSends: [] }), -$globals.Package); +$globals.TestResult); + + +$core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit'); +$globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`."; $core.addMethod( $core.method({ -selector: "load:", -protocol: '*Platform-ImportExport', -fn: function (aPackageName){ +selector: "announcer", +protocol: 'accessing', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._named_(aPackageName))._load(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@announcer"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackageName"], -source: "load: aPackageName\x0a\x09(self named: aPackageName) load", +args: [], +source: "announcer\x0a\x09^ announcer", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["load", "named:"] +messageSends: [] }), -$globals.Package.klass); +$globals.TestSuiteRunner); $core.addMethod( $core.method({ -selector: "load:fromNamespace:", -protocol: '*Platform-ImportExport', -fn: function (aPackageName,aString){ +selector: "contextOf:", +protocol: 'private', +fn: function (anInteger){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._named_(aPackageName))._loadFromNamespace_(aString); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){ +return $core.withContext(function($ctx2) { +return self._resume(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aPackageName", "aString"], -source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["loadFromNamespace:", "named:"] +args: ["anInteger"], +source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]", +referencedClasses: ["ReportingTestContext"], +messageSends: ["testCase:result:finished:", "at:", "resume"] }), -$globals.Package.klass); - -}); - -define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Kernel-Tests'); -$core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$globals.TestSuiteRunner); -$core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAddExtensionMethod", -protocol: 'tests', +selector: "initialize", +protocol: 'initialization', fn: function (){ var self=this; -var method,dirty; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} +function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10; -$2=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["package"]=1; -//>>excludeEnd("ctx"); -dirty=$recv($1)._isDirty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isDirty"]=1; -//>>excludeEnd("ctx"); -$4=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["package"]=2; -//>>excludeEnd("ctx"); -$recv($3)._beClean(); -$5=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=3; -//>>excludeEnd("ctx"); -method=$recv($5)._compile_protocol_("doNothing","**not-a-package"); -$8=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=4; -//>>excludeEnd("ctx"); -$7=$recv($8)._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["package"]=3; -//>>excludeEnd("ctx"); -$6=$recv($7)._isDirty(); -self._deny_($6); -$9=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=5; -//>>excludeEnd("ctx"); -$recv($9)._removeCompiledMethod_(method); -$10=dirty; -if($core.assert($10)){ -$recv($recv(self._class())._package())._beDirty(); +var $1; +( +$ctx1.supercall = true, +$globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), [])); +$ctx1.supercall = false; +self["@announcer"]=$recv($Announcer())._new(); +$ctx1.sendIdx["new"]=1; +self["@result"]=$recv($TestResult())._new(); +self["@runNextTest"]=(function(){ +var runs; +return $core.withContext(function($ctx2) { +runs=$recv(self["@result"])._runs(); +runs; +$1=$recv(runs).__lt($recv(self["@result"])._total()); +if($core.assert($1)){ +return $recv(self._contextOf_($recv(runs).__plus((1))))._start(); }; +}, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)}); +}); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"] +source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].", +referencedClasses: ["Announcer", "TestResult"], +messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"] }), -$globals.AnnouncementSubscriptionTest); +$globals.TestSuiteRunner); $core.addMethod( $core.method({ -selector: "testHandlesAnnouncement", -protocol: 'tests', +selector: "result", +protocol: 'accessing', fn: function (){ var self=this; -var subscription,announcementClass1,announcementClass2,classBuilder; -function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} -function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -classBuilder=$recv($ClassBuilder())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests"); -subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement()); -$1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["handlesAnnouncement:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(subscription)._handlesAnnouncement_(announcementClass1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["handlesAnnouncement:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false); -$recv(classBuilder)._basicRemoveClass_(announcementClass1); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.", -referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"] -}), -$globals.AnnouncementSubscriptionTest); - +var $1; +$1=self["@result"]; +return $1; +}, +args: [], +source: "result\x0a\x09^ result", +referencedClasses: [], +messageSends: [] +}), +$globals.TestSuiteRunner); -$core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testOnDo", -protocol: 'tests', +selector: "resume", +protocol: 'actions', fn: function (){ var self=this; -var counter,announcer; -function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} -function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -counter=(0); -announcer=$recv($Announcer())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv(announcer)._on_do_($SystemAnnouncement(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -counter=$recv(counter).__plus((1)); -return counter; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=announcer; -$2=$recv($SystemAnnouncement())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($1)._announce_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["announce:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(counter,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); -self._assert_equals_(counter,(2)); +$recv(self["@runNextTest"])._fork(); +$recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.", -referencedClasses: ["Announcer", "SystemAnnouncement"], -//>>excludeEnd("ide"); -messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"] +source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)", +referencedClasses: ["ResultAnnouncement"], +messageSends: ["fork", "announce:", "result:", "new"] }), -$globals.AnnouncerTest); +$globals.TestSuiteRunner); $core.addMethod( $core.method({ -selector: "testOnDoFor", -protocol: 'tests', +selector: "run", +protocol: 'actions', fn: function (){ var self=this; -var counter,announcer; -function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} -function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -counter=(0); -announcer=$recv($Announcer())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -counter=$recv(counter).__plus((1)); -return counter; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),self); -$1=announcer; -$2=$recv($SystemAnnouncement())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($1)._announce_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["announce:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(counter,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=announcer; -$4=$recv($SystemAnnouncement())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$recv($3)._announce_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["announce:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_(counter,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$recv(announcer)._unsubscribe_(self); -$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); -self._assert_equals_(counter,(2)); +$recv(self["@result"])._total_($recv(self["@suite"])._size()); +self._resume(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.", -referencedClasses: ["Announcer", "SystemAnnouncement"], -//>>excludeEnd("ide"); -messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"] +source: "run\x0a\x09result total: suite size.\x0a\x09self resume", +referencedClasses: [], +messageSends: ["total:", "size", "resume"] }), -$globals.AnnouncerTest); +$globals.TestSuiteRunner); $core.addMethod( $core.method({ -selector: "testOnDoOnce", -protocol: 'tests', -fn: function (){ +selector: "suite:", +protocol: 'accessing', +fn: function (aCollection){ var self=this; -var counter,announcer; -function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} -function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -counter=(0); -announcer=$recv($Announcer())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -counter=$recv(counter).__plus((1)); -return counter; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=announcer; -$2=$recv($SystemAnnouncement())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($1)._announce_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["announce:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(counter,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); -self._assert_equals_(counter,(1)); +self["@suite"]=aCollection; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.", -referencedClasses: ["Announcer", "SystemAnnouncement"], -//>>excludeEnd("ide"); -messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"] +args: ["aCollection"], +source: "suite: aCollection\x0a\x09suite := aCollection", +referencedClasses: [], +messageSends: [] }), -$globals.AnnouncerTest); - +$globals.TestSuiteRunner); -$core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "localReturnOnDoCatch", -protocol: 'fixture', +selector: "new", +protocol: 'instance creation', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $early={}; -try { -$recv((function(){ -throw $early=[(2)]; - -}))._on_do_($Error(),(function(){ - -})); -return (3); -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +self._shouldNotImplement(); +return self; +}, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["on:do:"] +source: "new\x0a\x09self shouldNotImplement", +referencedClasses: [], +messageSends: ["shouldNotImplement"] }), -$globals.BlockClosureTest); +$globals.TestSuiteRunner.klass); $core.addMethod( $core.method({ -selector: "localReturnOnDoMiss", -protocol: 'fixture', -fn: function (){ +selector: "on:", +protocol: 'instance creation', +fn: function (aCollection){ var self=this; -function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $early={}; -try { -$recv((function(){ -throw $early=[(2)]; - -}))._on_do_($Class(),(function(){ - -})); -return (3); -} -catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +var $2,$1; +$2=( +$ctx1.supercall = true, +$globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), [])); +$ctx1.supercall = false; +$1=$recv($2)._suite_(aCollection); +return $1; +}, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3", -referencedClasses: ["Class"], -//>>excludeEnd("ide"); -messageSends: ["on:do:"] +args: ["aCollection"], +source: "on: aCollection\x0a\x09^ super new suite: aCollection", +referencedClasses: [], +messageSends: ["suite:", "new"] }), -$globals.BlockClosureTest); +$globals.TestSuiteRunner.klass); $core.addMethod( $core.method({ -selector: "testCanClearInterval", -protocol: 'tests', +selector: "isTestClass", +protocol: '*SUnit', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$1=$recv(self._includesBehavior_($TestCase()))._and_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv($Error())._new())._signal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._valueWithInterval_((0)))._clearInterval(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._isAbstract())._not(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"] +source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]", +referencedClasses: ["TestCase"], +messageSends: ["and:", "includesBehavior:", "not", "isAbstract"] }), -$globals.BlockClosureTest); +$globals.Behavior); $core.addMethod( $core.method({ -selector: "testCanClearTimeout", -protocol: 'tests', +selector: "isTestPackage", +protocol: '*SUnit', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +$1=$recv(self._classes())._anySatisfy_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv($Error())._new())._signal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._valueWithTimeout_((0)))._clearTimeout(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +return $recv(each)._isTestClass(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"] +source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]", +referencedClasses: [], +messageSends: ["anySatisfy:", "classes", "isTestClass"] }), -$globals.BlockClosureTest); +$globals.Package); + +}); + +define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Compiler-Tests'); +$core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testCompiledSource", -protocol: 'tests', -fn: function (){ +selector: "analyze:forClass:", +protocol: 'convenience', +fn: function (aNode,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._compiledSource())._includesSubString_("function")); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +$recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode); +return aNode; +}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "includesSubString:", "compiledSource", "+"] +args: ["aNode", "aClass"], +source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode", +referencedClasses: ["SemanticAnalyzer"], +messageSends: ["visit:", "on:"] }), -$globals.BlockClosureTest); +$globals.ASTParsingTest); $core.addMethod( $core.method({ -selector: "testCurrySelf", -protocol: 'tests', -fn: function (){ +selector: "parse:", +protocol: 'parsing', +fn: function (aString){ var self=this; -var curriedMethod,array; -function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -curriedMethod=$recv($recv((function(selfarg,x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(selfarg)._at_(x); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._currySelf())._asCompiledMethod_("foo:"); -array=[(3), (1), (4)]; -$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(array)._foo_((2)),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))._ensure_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Array())._removeCompiledMethod_(curriedMethod); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($Smalltalk())._parse_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]", -referencedClasses: ["ClassBuilder", "Array"], -//>>excludeEnd("ide"); -messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"] +args: ["aString"], +source: "parse: aString\x0a\x09^ Smalltalk parse: aString", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:"] }), -$globals.BlockClosureTest); +$globals.ASTParsingTest); $core.addMethod( $core.method({ -selector: "testEnsure", -protocol: 'tests', -fn: function (){ +selector: "parse:forClass:", +protocol: 'parsing', +fn: function (aString,aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(){ -return (3); +var $1; +$1=self._analyze_forClass_(self._parse_(aString),aClass); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)}); +}, +args: ["aString", "aClass"], +source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass", +referencedClasses: [], +messageSends: ["analyze:forClass:", "parse:"] +}), +$globals.ASTParsingTest); -}))._ensure_((function(){ -return (4); -})),(3)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); + +$core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests'); +$core.addMethod( +$core.method({ +selector: "astPCNodeVisitor", +protocol: 'factory', +fn: function (){ +var self=this; +function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} +function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} +return $core.withContext(function($ctx1) { +var $2,$3,$4,$5,$1; +$2=$recv($ASTPCNodeVisitor())._new(); +$ctx1.sendIdx["new"]=1; +$3=$2; +$4=$recv($recv($AIContext())._new())._yourself(); +$ctx1.sendIdx["yourself"]=1; +$recv($3)._context_($4); +$5=$recv($2)._yourself(); +$1=$5; +return $1; +}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ensure:"] +source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", +referencedClasses: ["ASTPCNodeVisitor", "AIContext"], +messageSends: ["context:", "new", "yourself"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testEnsureRaises", +selector: "astPCNodeVisitorForSelector:", +protocol: 'factory', +fn: function (aString){ +var self=this; +function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} +function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} +return $core.withContext(function($ctx1) { +var $2,$3,$4,$5,$1; +$2=$recv($ASTPCNodeVisitor())._new(); +$ctx1.sendIdx["new"]=1; +$recv($2)._selector_(aString); +$3=$2; +$4=$recv($recv($AIContext())._new())._yourself(); +$ctx1.sendIdx["yourself"]=1; +$recv($3)._context_($4); +$5=$recv($2)._yourself(); +$1=$5; +return $1; +}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)}); +}, +args: ["aString"], +source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", +referencedClasses: ["ASTPCNodeVisitor", "AIContext"], +messageSends: ["selector:", "new", "context:", "yourself"] +}), +$globals.ASTPCNodeVisitorTest); + +$core.addMethod( +$core.method({ +selector: "testJSStatementNode", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast,visitor; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv($recv($Error())._new())._signal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._ensure_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +var $1,$2; +ast=self._parse_forClass_("foo ",$Object()); +$1=self._astPCNodeVisitor(); +$recv($1)._visit_(ast); +$2=$recv($1)._currentNode(); +self._assert_($recv($2)._isJSStatementNode()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "ensure:", "signal", "new"] +source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo ' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testExceptionSemantics", +selector: "testMessageSend", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._timeout_((100)); -$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -self._assert_(true); -$recv($Error())._signal(); -self._deny_(true); -return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["finished"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})))._valueWithTimeout_((0)); +var $1,$2; +ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object()); +$1=self._astPCNodeVisitorForSelector_("yourself"); +$recv($1)._visit_(ast); +$2=$recv($1)._currentNode(); +self._assert_equals_($recv($2)._selector(),"yourself"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"] +source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testLocalReturnOnDoCatch", +selector: "testMessageSendWithBlocks", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(self._localReturnOnDoCatch(),(2)); +var $1,$2; +ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object()); +$1=self._astPCNodeVisitorForSelector_("yourself"); +$recv($1)._visit_(ast); +$2=$recv($1)._currentNode(); +self._assert_equals_($recv($2)._selector(),"yourself"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "localReturnOnDoCatch"] +source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testLocalReturnOnDoMiss", +selector: "testMessageSendWithInlining", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(self._localReturnOnDoMiss(),(2)); +var $3,$4,$2,$1,$5,$6; +ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object()); +$ctx1.sendIdx["parse:forClass:"]=1; +$3=self._astPCNodeVisitorForSelector_("yourself"); +$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1; +$recv($3)._visit_(ast); +$ctx1.sendIdx["visit:"]=1; +$4=$recv($3)._currentNode(); +$ctx1.sendIdx["currentNode"]=1; +$2=$4; +$1=$recv($2)._selector(); +$ctx1.sendIdx["selector"]=1; +self._assert_equals_($1,"yourself"); +$ctx1.sendIdx["assert:equals:"]=1; +ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object()); +$5=self._astPCNodeVisitorForSelector_("asBoolean"); +$recv($5)._visit_(ast); +$6=$recv($5)._currentNode(); +self._assert_equals_($recv($6)._selector(),"asBoolean"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "localReturnOnDoMiss"] +source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testNewWithValues", +selector: "testNoMessageSend", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); - - function TestConstructor(arg1, arg2, arg3) {} - TestConstructor.prototype.name = 'theTestPrototype'; - - var wrappedConstructor = $recv(TestConstructor); - var result = wrappedConstructor._newWithValues_([1, 2, 3 ]); - self._assert_(result instanceof TestConstructor); - self._assert_equals_(result.name, 'theTestPrototype'); - - "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made." - self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);; +var $1,$2; +ast=self._parse_forClass_("foo ^ self",$Object()); +$1=self._astPCNodeVisitor(); +$recv($1)._visit_(ast); +$2=$recv($1)._currentNode(); +self._assert_($recv($2)._isNil()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); $core.addMethod( $core.method({ -selector: "testNumArgs", +selector: "testPC", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var ast,visitor; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv((function(){ - -}))._numArgs(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["numArgs"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(a,b){ - -}))._numArgs(),(2)); +var $1,$2; +ast=self._parse_forClass_("foo ",$Object()); +$1=self._astPCNodeVisitor(); +$recv($1)._visit_(ast); +$2=$recv($1)._currentNode(); +self._assert_($recv($2)._isJSStatementNode()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "numArgs"] +source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo ' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode", +referencedClasses: ["Object"], +messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"] }), -$globals.BlockClosureTest); +$globals.ASTPCNodeVisitorTest); + + +$core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testOnDo", +selector: "testNodeAtPosition", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv($Error())._new())._signal(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(ex){ -return true; +var $3,$4,$2,$1,$7,$8,$6,$5; +node=self._parse_("yourself\x0a\x09^ self"); +$ctx1.sendIdx["parse:"]=1; +$3=node; +$4=(2).__at((4)); +$ctx1.sendIdx["@"]=1; +$2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){ +return nil; -}))); +})); +$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1; +$1=$recv($2)._source(); +self._assert_equals_($1,"self"); +$ctx1.sendIdx["assert:equals:"]=1; +node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]"); +$ctx1.sendIdx["parse:"]=2; +$7=node; +$8=(2).__at((7)); +$ctx1.sendIdx["@"]=2; +$6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){ +return nil; + +})); +$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2; +$5=$recv($6)._selector(); +$ctx1.sendIdx["selector"]=1; +self._assert_equals_($5,"ifTrue:"); +$ctx1.sendIdx["assert:equals:"]=2; +node=self._parse_("foo\x0a\x09self foo; bar; baz"); +self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){ +return nil; + +})))._selector(),"foo"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["assert:", "on:do:", "signal", "new"] +source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'", +referencedClasses: [], +messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"] }), -$globals.BlockClosureTest); +$globals.ASTPositionTest); + + +$core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testValue", -protocol: 'tests', +selector: "codeGeneratorClass", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._value(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))._value_((2)),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(x,y){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x).__star(y); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)}); -//>>excludeEnd("ctx"); -}))._value_value_((2),(4)),(8)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(a,b,c){ -return (1); +function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)} +return $CodeGenerator(); -}))._value(),(1)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"] +source: "codeGeneratorClass\x0a\x09^ CodeGenerator", +referencedClasses: ["CodeGenerator"], +messageSends: [] }), -$globals.BlockClosureTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testValueWithPossibleArguments", -protocol: 'tests', +selector: "compiler", +protocol: 'factory', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv((function(){ -return (1); - -}))._valueWithPossibleArguments_([(3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["valueWithPossibleArguments:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv((function(a){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(a).__plus((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))._valueWithPossibleArguments_([(3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["valueWithPossibleArguments:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(7)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv((function(a,b){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(a).__plus(b); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)}); -//>>excludeEnd("ctx"); -}))._valueWithPossibleArguments_([(3), (4), (5)]),(7)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($Compiler())._new(); +$recv($2)._codeGeneratorClass_(self._codeGeneratorClass()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"] +source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself", +referencedClasses: ["Compiler"], +messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"] }), -$globals.BlockClosureTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testWhileFalse", -protocol: 'tests', +selector: "setUp", +protocol: 'initialization', fn: function (){ var self=this; -var i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -i=(0); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(i).__gt((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[">"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileFalse_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -return i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_(i,(6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -i=(0); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -i; -return $recv(i).__gt((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -}))._whileFalse(); -self._assert_equals_(i,(6)); +self["@receiver"]=$recv($DoIt())._new(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"] +source: "setUp\x0a\x09receiver := DoIt new", +referencedClasses: ["DoIt"], +messageSends: ["new"] }), -$globals.BlockClosureTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testWhileTrue", -protocol: 'tests', -fn: function (){ +selector: "should:receiver:return:", +protocol: 'testing', +fn: function (aString,anObject,aResult){ var self=this; -var i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var method,result; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -i=(0); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(i).__lt((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["<"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -return i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_(i,(5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -i=(0); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -i; -return $recv(i).__lt((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -}))._whileTrue(); -self._assert_equals_(i,(5)); +var $1,$2; +self["@receiver"]=anObject; +$1=self._compiler(); +$2=$recv(anObject)._class(); +$ctx1.sendIdx["class"]=1; +method=$recv($1)._install_forClass_protocol_(aString,$2,"tests"); +result=$recv(self["@receiver"])._perform_($recv(method)._selector()); +$recv($recv(anObject)._class())._removeCompiledMethod_(method); +self._assert_equals_(aResult,result); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5", +args: ["aString", "anObject", "aResult"], +source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"] +messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"] }), -$globals.BlockClosureTest); - - +$globals.CodeGeneratorTest); -$core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testEquality", -protocol: 'tests', -fn: function (){ +selector: "should:return:", +protocol: 'testing', +fn: function (aString,anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11; -$1=(0).__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$2=false.__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$3="".__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$4=false.__eq(""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=4; -//>>excludeEnd("ctx"); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=4; -//>>excludeEnd("ctx"); -$5=true.__eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=5; -//>>excludeEnd("ctx"); -self._assert_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$6=false.__eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=6; -//>>excludeEnd("ctx"); -self._deny_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=5; -//>>excludeEnd("ctx"); -$7=true.__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=7; -//>>excludeEnd("ctx"); -self._deny_($7); -$8=false.__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=8; -//>>excludeEnd("ctx"); -self._assert_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$10=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$9=$recv($10).__eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=9; -//>>excludeEnd("ctx"); -self._assert_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$12=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$11=$recv($12).__eq(true._yourself()); -self._assert_($11); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=self._should_receiver_return_(aString,self["@receiver"],anObject); +return $1; +}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)", +args: ["aString", "anObject"], +source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["deny:", "=", "assert:", "yourself"] +messageSends: ["should:receiver:return:"] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testIdentity", -protocol: 'tests', +selector: "tearDown", +protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11; -$1=(0).__eq_eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$2=false.__eq_eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$3="".__eq_eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$4=false.__eq_eq(""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=4; -//>>excludeEnd("ctx"); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=4; -//>>excludeEnd("ctx"); -$5=true.__eq_eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=5; -//>>excludeEnd("ctx"); -self._assert_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$6=false.__eq_eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=6; -//>>excludeEnd("ctx"); -self._deny_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=5; -//>>excludeEnd("ctx"); -$7=true.__eq_eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=7; -//>>excludeEnd("ctx"); -self._deny_($7); -$8=false.__eq_eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=8; -//>>excludeEnd("ctx"); -self._assert_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$10=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$9=$recv($10).__eq_eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=9; -//>>excludeEnd("ctx"); -self._assert_($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$12=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$11=$recv($12).__eq_eq(true._yourself()); -self._assert_($11); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself", +source: "tearDown\x0a\x09\x22receiver := nil\x22", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["deny:", "==", "assert:", "yourself"] +messageSends: [] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testIfTrueIfFalse", +selector: "testAssignment", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$8; -if($core.assert(true)){ -$1="alternative block"; -}; -self._assert_equals_($1,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -if(!$core.assert(true)){ -$2="alternative block"; -}; -self._assert_equals_($2,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -if($core.assert(false)){ -$3="alternative block"; -}; -self._assert_equals_($3,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -if(!$core.assert(false)){ -$4="alternative block"; -}; -self._assert_equals_($4,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -if($core.assert(false)){ -$5="alternative block"; -} else { -$5="alternative block2"; -}; -self._assert_equals_($5,"alternative block2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -if($core.assert(false)){ -$6="alternative block2"; -} else { -$6="alternative block"; -}; -self._assert_equals_($6,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -if($core.assert(true)){ -$7="alternative block"; -} else { -$7="alternative block2"; -}; -self._assert_equals_($7,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=7; -//>>excludeEnd("ctx"); -if($core.assert(true)){ -$8="alternative block2"; -} else { -$8="alternative block"; -}; -self._assert_equals_($8,"alternative block2"); +self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.", +source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"] +messageSends: ["should:return:"] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testIfTrueIfFalseWithBoxing", +selector: "testBackslashSelectors", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15; -$2=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -if($core.assert($2)){ -$1="alternative block"; -}; -self._assert_equals_($1,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$4=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -if(!$core.assert($4)){ -$3="alternative block"; -}; -self._assert_equals_($3,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$6=false._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -if($core.assert($6)){ -$5="alternative block"; -}; -self._assert_equals_($5,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$8=false._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=4; -//>>excludeEnd("ctx"); -if(!$core.assert($8)){ -$7="alternative block"; -}; -self._assert_equals_($7,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$10=false._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=5; -//>>excludeEnd("ctx"); -if($core.assert($10)){ -$9="alternative block"; -} else { -$9="alternative block2"; -}; -self._assert_equals_($9,"alternative block2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$12=false._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=6; -//>>excludeEnd("ctx"); -if($core.assert($12)){ -$11="alternative block2"; -} else { -$11="alternative block"; -}; -self._assert_equals_($11,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -$14=true._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=7; -//>>excludeEnd("ctx"); -if($core.assert($14)){ -$13="alternative block"; -} else { -$13="alternative block2"; -}; -self._assert_equals_($13,"alternative block"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=7; -//>>excludeEnd("ctx"); -$16=true._yourself(); -if($core.assert($16)){ -$15="alternative block2"; -} else { -$15="alternative block"; -}; -self._assert_equals_($15,"alternative block2"); +self._should_return_("\x5c arg ^ 4",(4)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("\x5c\x5c arg ^ 42",(42)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.", +source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"] +messageSends: ["should:return:"] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testLogic", +selector: "testBlockReturn", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23; -$1=true.__and(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=true.__and(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$3=false.__and(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$5=false.__and(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=4; -//>>excludeEnd("ctx"); -$4=self._deny_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$6=true.__or(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=1; -//>>excludeEnd("ctx"); -self._assert_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$7=true.__or(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=2; -//>>excludeEnd("ctx"); -self._assert_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$8=false.__or(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=3; -//>>excludeEnd("ctx"); -self._assert_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=4; -//>>excludeEnd("ctx"); -$10=false.__or(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=4; -//>>excludeEnd("ctx"); -$9=self._deny_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=4; -//>>excludeEnd("ctx"); -$12=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=1; -//>>excludeEnd("ctx"); -$11=true.__and($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=5; -//>>excludeEnd("ctx"); -self._assert_($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=5; -//>>excludeEnd("ctx"); -$14=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=2; -//>>excludeEnd("ctx"); -$13=$recv($14).__and(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["&"]=6; -//>>excludeEnd("ctx"); -self._deny_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=5; -//>>excludeEnd("ctx"); -$17=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=3; -//>>excludeEnd("ctx"); -$18=(1).__gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=4; -//>>excludeEnd("ctx"); -$16=$recv($17).__and($18); -$15=self._deny_($16); -$20=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=5; -//>>excludeEnd("ctx"); -$19=false.__or($20); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=5; -//>>excludeEnd("ctx"); -self._assert_($19); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=6; -//>>excludeEnd("ctx"); -$22=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=6; -//>>excludeEnd("ctx"); -$21=$recv($22).__or(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["|"]=6; -//>>excludeEnd("ctx"); -self._assert_($21); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=7; -//>>excludeEnd("ctx"); -$25=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=7; -//>>excludeEnd("ctx"); -$24=$recv($25).__or((1).__gt((2))); -$23=self._assert_($24); +self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))", +source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "&", "deny:", "|", ">"] +messageSends: ["should:return:"] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testLogicKeywords", +selector: "testCascades", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20; -$1=true._and_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=true._and_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$3=false._and_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$5=false._and_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=4; -//>>excludeEnd("ctx"); -$4=self._deny_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$6=true._or_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=1; -//>>excludeEnd("ctx"); -self._assert_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$7=true._or_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=2; -//>>excludeEnd("ctx"); -self._assert_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$8=false._or_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=3; -//>>excludeEnd("ctx"); -self._assert_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=4; -//>>excludeEnd("ctx"); -$10=false._or_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=4; -//>>excludeEnd("ctx"); -$9=self._deny_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=4; -//>>excludeEnd("ctx"); -$11=true._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[">"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=5; -//>>excludeEnd("ctx"); -self._assert_($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=5; -//>>excludeEnd("ctx"); -$13=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=2; -//>>excludeEnd("ctx"); -$12=$recv($13)._and_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["and:"]=6; -//>>excludeEnd("ctx"); -self._deny_($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=5; -//>>excludeEnd("ctx"); -$16=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=3; -//>>excludeEnd("ctx"); -$15=$recv($16)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[">"]=4; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)}); -//>>excludeEnd("ctx"); -})); -$14=self._deny_($15); -$17=false._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[">"]=5; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=5; -//>>excludeEnd("ctx"); -self._assert_($17); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=6; -//>>excludeEnd("ctx"); -$19=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=6; -//>>excludeEnd("ctx"); -$18=$recv($19)._or_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["or:"]=6; -//>>excludeEnd("ctx"); -self._assert_($18); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=7; -//>>excludeEnd("ctx"); -$22=(1).__gt((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=7; -//>>excludeEnd("ctx"); -$21=$recv($22)._or_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1).__gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)}); -//>>excludeEnd("ctx"); -})); -$20=self._assert_($21); +self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])", +source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "and:", "deny:", "or:", ">"] +messageSends: ["should:return:"] }), -$globals.BooleanTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testNonBooleanError", +selector: "testCascadesWithInlining", protocol: 'tests', fn: function (){ var self=this; -function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -if($core.assert("")){ -} else { -}; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$NonBooleanReceiver()); +self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver", -referencedClasses: ["NonBooleanReceiver"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "ifTrue:ifFalse:"] +source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.BooleanTest); - +$globals.CodeGeneratorTest); +$core.addMethod( +$core.method({ +selector: "testDynamicArrayElementsOrdered", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]); +return self; +}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)}); +}, +args: [], +source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).", +referencedClasses: [], +messageSends: ["should:return:"] +}), +$globals.CodeGeneratorTest); -$core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'running', +selector: "testDynamicDictionaryElementsOrdered", +protocol: 'tests', fn: function (){ var self=this; -function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@builder"]=$recv($ClassBuilder())._new(); +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp\x0a\x09builder := ClassBuilder new", -referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); -messageSends: ["new"] +source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "tearDown", -protocol: 'running', +selector: "testDynamicDictionaryWithMoreArrows", +protocol: 'tests', fn: function (){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$receiver; -$1=self["@theClass"]; -if(($receiver = $1) == null || $receiver.isNil){ -$1; -} else { -$recv($Smalltalk())._removeClass_(self["@theClass"]); -self["@theClass"]=nil; -self["@theClass"]; -}; +var $2,$1; +$2=$recv((1).__minus_gt((2))).__minus_gt((3)); +$ctx1.sendIdx["->"]=1; +$1=$recv($HashedCollection())._with_($2); +self._should_return_("foo ^ #{1->2->3}",$1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["ifNotNil:", "removeClass:"] +source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)", +referencedClasses: ["HashedCollection"], +messageSends: ["should:return:", "with:", "->"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testClassCopy", +selector: "testGlobalVar", protocol: 'tests', fn: function (){ var self=this; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5,$8,$7; -self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); -$2=$recv(self["@theClass"])._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq_eq($recv($ObjectMock())._superclass()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(self["@theClass"])._instanceVariableNames(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instanceVariableNames"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=$recv(self["@theClass"])._package(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["package"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6).__eq_eq($recv($ObjectMock())._package()); -self._assert_($5); -$8=$recv(self["@theClass"])._methodDictionary(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["methodDictionary"]=1; -//>>excludeEnd("ctx"); -$7=$recv($8)._keys(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["keys"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys()); +self._should_return_("foo ^ eval class",$BlockClosure()); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ Math cos: 0",(1)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ NonExistingVar",nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys", -referencedClasses: ["ObjectMock"], -//>>excludeEnd("ide"); -messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"] +source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil", +referencedClasses: ["BlockClosure"], +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testClassMigration", +selector: "testInnerTemporalDependentElementsOrdered", protocol: 'tests', fn: function (){ var self=this; -var instance,oldClass; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10; -oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); -$2=$recv($Smalltalk())._globals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["globals"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._at_("ObjectMock2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); -instance=$recv($1)._new(); -$4=$recv($Smalltalk())._globals(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["globals"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._at_("ObjectMock2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=2; -//>>excludeEnd("ctx"); -$recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests"); -$5=$recv(oldClass).__eq_eq($ObjectMock2()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._deny_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._assert_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$7=$recv($ObjectMock2())._selectors(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selectors"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($7,$recv(oldClass)._selectors()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$8=$recv($ObjectMock2())._comment(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["comment"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($8,$recv(oldClass)._comment()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$9=$recv($recv($ObjectMock2())._package())._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($9,"Kernel-Tests"); -$11=$recv(instance)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$10=$recv($11).__eq_eq($ObjectMock2()); -self._deny_($10); -self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil()); -$recv($Smalltalk())._removeClass_($ObjectMock2()); +var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10; +$2="foo".__minus_gt($Array()); +$ctx1.sendIdx["->"]=1; +$3="bar".__minus_gt((2)); +$ctx1.sendIdx["->"]=2; +$1=[$2,$3]; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1); +$ctx1.sendIdx["should:return:"]=1; +$5="foo".__minus_gt($Array()); +$ctx1.sendIdx["->"]=3; +$6="bar".__minus_gt((2)); +$ctx1.sendIdx["->"]=4; +$4=[$5,$6]; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4); +$ctx1.sendIdx["should:return:"]=2; +$8="foo".__minus_gt((1)); +$ctx1.sendIdx["->"]=5; +$9="bar".__minus_gt((2)); +$ctx1.sendIdx["->"]=6; +$7=[$8,$9]; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7); +$ctx1.sendIdx["should:return:"]=3; +$11="foo".__minus_gt((1)); +$ctx1.sendIdx["->"]=7; +$10=[$11,"bar".__minus_gt((2))]; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)])); +return self; +}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)}); +}, +args: [], +source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.", +referencedClasses: ["Array"], +messageSends: ["should:return:", "->"] +}), +$globals.CodeGeneratorTest); + +$core.addMethod( +$core.method({ +selector: "testJSStatement", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._should_return_("foo ",(5)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2", -referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"], -//>>excludeEnd("ide"); -messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"] +source: "testJSStatement\x0a\x09self should: 'foo ' return: 5", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testClassMigrationWithClassInstanceVariables", +selector: "testLexicalScope", protocol: 'tests', fn: function (){ var self=this; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); -$1=$recv($ObjectMock2())._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -$recv($1)._instanceVariableNames_("foo bar"); -$recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests"); -self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]); -$recv($Smalltalk())._removeClass_($ObjectMock2()); +self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2", -referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"] +source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testClassMigrationWithSubclasses", +selector: "testLiterals", protocol: 'tests', fn: function (){ var self=this; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} -function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3; -$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); -$recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1; -//>>excludeEnd("ctx"); -$recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2; -//>>excludeEnd("ctx"); -$recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests"); -$2=$recv($ObjectMock())._subclasses(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["subclasses"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._includes_($ObjectMock2()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includes:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=$recv($ObjectMock2())._subclasses(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["subclasses"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._includes_($ObjectMock3()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includes:"]=2; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4())); -$recv($recv($ObjectMock())._allSubclasses())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Smalltalk())._removeClass_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +self._should_return_("foo ^ 1",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ 'hello'","hello"); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo ^ true",true); +$ctx1.sendIdx["should:return:"]=5; +self._should_return_("foo ^ false",false); +$ctx1.sendIdx["should:return:"]=6; +self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)])); +$ctx1.sendIdx["should:return:"]=7; +self._should_return_("foo ^ #hello","hello"); +$ctx1.sendIdx["should:return:"]=8; +self._should_return_("foo ^ $h","h"); +$ctx1.sendIdx["should:return:"]=9; +self._should_return_("foo ^ -123.456",(-123.456)); +$ctx1.sendIdx["should:return:"]=10; +self._should_return_("foo ^ -2.5e4",(-25000)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]", -referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"], -//>>excludeEnd("ide"); -messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"] +source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testInstanceVariableNames", +selector: "testLocalReturn", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]); +self._should_return_("foo ^ 1",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ 1 + 1",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ",self["@receiver"]); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo self asString",self["@receiver"]); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')", +source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "instanceVariableNamesFor:"] +messageSends: ["should:return:"] }), -$globals.ClassBuilderTest); - - +$globals.CodeGeneratorTest); -$core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "assertSameContents:as:", -protocol: 'convenience', -fn: function (aCollection,anotherCollection){ +selector: "testMessageSends", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3; -$2=$recv(aCollection)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq($recv(anotherCollection)._size()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$recv(aCollection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(aCollection)._occurrencesOf_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["occurrencesOf:"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each)); -return self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +self._should_return_("foo ^ 1 asString","1"); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ 1 + 1",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ 1 + 2 * 3",(9)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aCollection", "anotherCollection"], -source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]", +args: [], +source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collection", -protocol: 'fixture', +selector: "testMultipleSequences", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility", +source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'fixture', +selector: "testMutableLiterals", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._class())._collectionClass(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]); +return self; +}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass", +source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collectionClass", "class"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testNestedIfTrue", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility", +source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collectionSize", -protocol: 'fixture', +selector: "testNestedSends", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString", +referencedClasses: ["Point"], +messageSends: ["should:return:", "asString", "x:y:", "@"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", -protocol: 'fixture', +selector: "testNonLocalReturn", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_return_("foo [ ^ 1 ] value",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo [ ^ 1 + 1 ] value",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility", +source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', +selector: "testPascalCaseGlobal", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object")); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^NonExistent",nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil", +referencedClasses: ["Smalltalk"], +messageSends: ["should:return:", "at:", "globals"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "isCollectionReadOnly", -protocol: 'testing', +selector: "testSendReceiverAndArgumentsOrdered", +protocol: 'tests', fn: function (){ var self=this; -return false; - +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $core.withContext(function($ctx1) { +self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]); +return self; +}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isCollectionReadOnly\x0a\x09^ false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.", +referencedClasses: ["Array"], +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "sampleNewValue", -protocol: 'fixture', +selector: "testSuperSend", +protocol: 'tests', fn: function (){ var self=this; -return "N"; - +return $core.withContext(function($ctx1) { +self._should_receiver_return_("foo ^ super isBoolean",true,false); +return self; +}, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'", +source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["should:receiver:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "sampleNewValueAsCollection", -protocol: 'fixture', +selector: "testTempVariables", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._collectionClass())._with_(self._sampleNewValue()); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +self._should_return_("foo | a | ^ a",nil); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo | AVariable | ^ AVariable",nil); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo | a b c | ^ c",nil); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo | a | [ | d | ^ d ] value",nil); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo | a | a:= 1. ^ a",(1)); +$ctx1.sendIdx["should:return:"]=5; +self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue", +source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["with:", "collectionClass", "sampleNewValue"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAddAll", +selector: "testThisContext", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$3=$2; -$5=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($3)._addAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=1; -//>>excludeEnd("ctx"); -$6=$recv($2)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$1=$6; -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$10=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=2; -//>>excludeEnd("ctx"); -$9=$recv($10)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$11=$9; -$12=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$recv($11)._addAll_($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=2; -//>>excludeEnd("ctx"); -$13=$recv($9)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$8=$13; -$14=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($8,$14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$17=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=3; -//>>excludeEnd("ctx"); -$16=$recv($17)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$18=$16; -$20=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=4; -//>>excludeEnd("ctx"); -$19=$recv($20)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -$recv($18)._addAll_($19); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=3; -//>>excludeEnd("ctx"); -$21=$recv($16)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -$15=$21; -self._assert_equals_($15,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$23=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=5; -//>>excludeEnd("ctx"); -$24=$23; -$25=self._sampleNewValueAsCollection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValueAsCollection"]=1; -//>>excludeEnd("ctx"); -$recv($24)._addAll_($25); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=4; -//>>excludeEnd("ctx"); -$26=$recv($23)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=4; -//>>excludeEnd("ctx"); -$22=$26; -$27=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($22,$27); -$28=self._sampleNewValueAsCollection(); -$recv($28)._addAll_(self._collection()); -$29=$recv($28)._yourself(); -self._assertSameContents_as_($29,self._collectionWithNewValue()); +self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue", +source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAllSatisfy", +selector: "testifFalse", protocol: 'tests', fn: function (){ var self=this; -var collection,anyOne; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -collection=self._collection(); -anyOne=$recv(collection)._anyOne(); -$1=$recv(collection)._allSatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(collection)._includes_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["allSatisfy:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -self._deny_($recv(collection)._allSatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__tild_eq(anyOne); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))); +self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo false ifFalse: [ ^ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ true ifFalse: [ 1 ]",nil); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ false ifFalse: [ 2 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])", +source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAnyOne", +selector: "testifFalseIfTrue", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv(self._collectionClass())._new())._anyOne(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["anyOne"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._includes_($recv(self._collection())._anyOne()); -self._assert_($1); +self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"] +source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAnySatisfy", +selector: "testifNil", protocol: 'tests', fn: function (){ var self=this; -var anyOne; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2; -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -anyOne=$recv($1)._anyOne(); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$2=$recv($3)._anySatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__eq(anyOne); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["anySatisfy:"]=1; -//>>excludeEnd("ctx"); -self._assert_($2); -self._deny_($recv(self._collection())._anySatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__eq($recv($Object())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))); +self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ nil ifNil: [ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo nil ifNil: [ ^ 2 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"] +source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.", +referencedClasses: [], +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAsArray", +selector: "testifNilIfNotNil", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($1,$recv(self._collection())._asArray()); +self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray", +source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assertSameContents:as:", "collection", "asArray"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAsOrderedCollection", +selector: "testifNotNil", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection()); +self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection", +source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testAsSet", +selector: "testifNotNilWithArgument", protocol: 'tests', fn: function (){ var self=this; -var c,set; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -c=self._collectionWithDuplicates(); -set=$recv(c)._asSet(); -self._assert_equals_($recv(set)._size(),(5)); -$recv(c)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_($recv(set)._includes_(each)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5)); +$ctx1.sendIdx["should:return:"]=4; +self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3)); +$ctx1.sendIdx["should:return:"]=5; +self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]", +source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testCollect", +selector: "testifTrue", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._collect_((function(each){ -return each; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collect:"]=1; -//>>excludeEnd("ctx"); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$5=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._collect_((function(each){ -return each; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collect:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,self._collectionWithNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$8=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$7=$recv($8)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$6=$recv($7)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["printString"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collect:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($6,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$11=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$10=$recv($11)._collect_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collect:"]=4; -//>>excludeEnd("ctx"); -$9=$recv($10)._detect_((function(){ -return true; - -})); -self._assert_equals_($9,self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collection())._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); -//>>excludeEnd("ctx"); -})),self._collectionOfPrintStrings()); +self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo true ifTrue: [ ^ 2 ]",(2)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ false ifTrue: [ 1 ]",nil); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ true ifTrue: [ 2 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings", +source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); $core.addMethod( $core.method({ -selector: "testComma", +selector: "testifTrueIfFalse", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$4=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$8=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=2; -//>>excludeEnd("ctx"); -$7=$recv($8)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$9=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$6=$recv($7).__comma($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$10=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($6,$10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$13=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=3; -//>>excludeEnd("ctx"); -$12=$recv($13)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$15=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=4; -//>>excludeEnd("ctx"); -$14=$recv($15)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -$11=$recv($12).__comma($14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($11,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$17=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=5; -//>>excludeEnd("ctx"); -$18=self._sampleNewValueAsCollection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValueAsCollection"]=1; -//>>excludeEnd("ctx"); -$16=$recv($17).__comma($18); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); -$19=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($16,$19); -self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue()); +self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2)); +$ctx1.sendIdx["should:return:"]=1; +self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1)); +$ctx1.sendIdx["should:return:"]=2; +self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1)); +$ctx1.sendIdx["should:return:"]=3; +self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue", +source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"] +messageSends: ["should:return:"] }), -$globals.CollectionTest); +$globals.CodeGeneratorTest); + + +$core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testDetect", -protocol: 'tests', -fn: function (){ +selector: "analyze:forClass:", +protocol: 'parsing', +fn: function (aNode,aClass){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$6,$5,$7; -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -return $recv($1)._detect_((function(){ -return true; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["detect:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -return $recv($2)._detect_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["detect:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -}),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(self._sampleNewValueAsCollection())._detect_((function(){ -return true; +$recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode); +return aNode; +}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)}); +}, +args: ["aNode", "aClass"], +source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode", +referencedClasses: ["SemanticAnalyzer"], +messageSends: ["visit:", "on:"] +}), +$globals.ASTInterpreterTest); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:"]=3; -//>>excludeEnd("ctx"); -$4=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($3,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$5=$recv(self._collectionWithNewValue())._detect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$core.addMethod( +$core.method({ +selector: "interpret:receiver:withArguments:", +protocol: 'private', +fn: function (aString,anObject,aDictionary){ +var self=this; +var ctx,ast,interpreter; +function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} +function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$6,$4,$receiver; +interpreter=$recv($ASTInterpreter())._new(); +$ctx1.sendIdx["new"]=1; +ast=self._parse_forClass_(aString,$recv(anObject)._class()); +$1=$recv($AIContext())._new(); +$recv($1)._receiver_(anObject); +$recv($1)._interpreter_(interpreter); +$2=$recv($1)._yourself(); +ctx=$2; +$3=$recv(ast)._sequenceNode(); +if(($receiver = $3) == null || $receiver.isNil){ +$3; +} else { +var sequence; +sequence=$receiver; +$recv($recv(sequence)._temps())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$6=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -return $recv(each).__eq($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); -//>>excludeEnd("ctx"); +return $recv(ctx)._defineLocal_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:"]=4; -//>>excludeEnd("ctx"); -$7=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValue"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$7); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +}; +$recv(aDictionary)._keysAndValuesDo_((function(key,value){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._collection())._detect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(each).__eq(self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)}); -//>>excludeEnd("ctx"); +return $recv(ctx)._localAt_put_(key,value); +}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +$5=interpreter; +$recv($5)._context_(ctx); +$recv($5)._interpret_($recv(ast)._nextChild()); +$recv($5)._proceed(); +$6=$recv($5)._result(); +$4=$6; +return $4; +}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="] +args: ["aString", "anObject", "aDictionary"], +source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result", +referencedClasses: ["ASTInterpreter", "AIContext"], +messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"] }), -$globals.CollectionTest); +$globals.ASTInterpreterTest); $core.addMethod( $core.method({ -selector: "testDetectIfNone", -protocol: 'tests', -fn: function (){ +selector: "parse:", +protocol: 'parsing', +fn: function (aString){ var self=this; -var sentinel; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10; -sentinel=$recv($Object())._new(); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._detect_ifNone_((function(){ -return true; +var $1; +$1=$recv($Smalltalk())._parse_(aString); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)}); +}, +args: ["aString"], +source: "parse: aString\x0a\x09^ Smalltalk parse: aString", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:"] +}), +$globals.ASTInterpreterTest); -}),(function(){ -return sentinel; +$core.addMethod( +$core.method({ +selector: "parse:forClass:", +protocol: 'parsing', +fn: function (aString,aClass){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._analyze_forClass_(self._parse_(aString),aClass); +return $1; +}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)}); +}, +args: ["aString", "aClass"], +source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass", +referencedClasses: [], +messageSends: ["analyze:forClass:", "parse:"] +}), +$globals.ASTInterpreterTest); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:ifNone:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__tild_eq(sentinel); -self._assert_($1); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5)._detect_ifNone_((function(){ -return false; +$core.addMethod( +$core.method({ +selector: "should:receiver:return:", +protocol: 'testing', +fn: function (aString,anObject,aResult){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +self["@receiver"]=anObject; +$1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult); +return $1; +}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)}); +}, +args: ["aString", "anObject", "aResult"], +source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult", +referencedClasses: [], +messageSends: ["assert:equals:", "interpret:receiver:withArguments:"] +}), +$globals.ASTInterpreterTest); -}),(function(){ -return sentinel; +$core.addMethod( +$core.method({ +selector: "should:return:", +protocol: 'testing', +fn: function (aString,anObject){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=self._should_receiver_return_(aString,self["@receiver"],anObject); +return $1; +}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)}); +}, +args: ["aString", "anObject"], +source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject", +referencedClasses: [], +messageSends: ["should:receiver:return:"] +}), +$globals.ASTInterpreterTest); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:ifNone:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,sentinel); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){ -return true; -}),(function(){ -return sentinel; -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:ifNone:"]=3; -//>>excludeEnd("ctx"); -$7=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($6,$7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests'); +$core.addMethod( +$core.method({ +selector: "interpret:receiver:withArguments:", +protocol: 'private', +fn: function (aString,anObject,aDictionary){ +var self=this; +var ctx,ast,debugger_; +function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} +function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} +function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$6,$7,$5,$receiver; +$1=$recv($AIContext())._new(); +$ctx1.sendIdx["new"]=1; +$recv($1)._receiver_(anObject); +$recv($1)._interpreter_($recv($ASTInterpreter())._new()); +$2=$recv($1)._yourself(); +ctx=$2; +ast=self._parse_forClass_(aString,$recv(anObject)._class()); +$3=$recv(ast)._sequenceNode(); +if(($receiver = $3) == null || $receiver.isNil){ +$3; +} else { +var sequence; +sequence=$receiver; +$recv($recv(sequence)._temps())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$9=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -return $recv(each).__eq($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)}); -//>>excludeEnd("ctx"); -}),(function(){ -return sentinel; - +return $recv(ctx)._defineLocal_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["detect:ifNone:"]=4; -//>>excludeEnd("ctx"); -$10=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sampleNewValue"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($8,$10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +}; +$recv(aDictionary)._keysAndValuesDo_((function(key,value){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__eq(self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)}); -//>>excludeEnd("ctx"); -}),(function(){ -return sentinel; - -})),sentinel); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="] +return $recv(ctx)._localAt_put_(key,value); +}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); +})); +$4=$recv(ctx)._interpreter(); +$ctx1.sendIdx["interpreter"]=1; +$recv($4)._context_(ctx); +$ctx1.sendIdx["context:"]=1; +$recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild()); +debugger_=$recv($ASTDebugger())._context_(ctx); +$6=debugger_; +$recv($6)._proceed(); +$7=$recv($6)._result(); +$5=$7; +return $5; +}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)}); +}, +args: ["aString", "anObject", "aDictionary"], +source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result", +referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"], +messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"] }), -$globals.CollectionTest); +$globals.ASTDebuggerTest); + + +$core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testDo", -protocol: 'tests', +selector: "codeGeneratorClass", +protocol: 'accessing', fn: function (){ var self=this; -var newCollection; -function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -newCollection=$recv($OrderedCollection())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$recv($1)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(newCollection)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["do:"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_(self._collection(),newCollection); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assertSameContents:as:"]=1; -//>>excludeEnd("ctx"); -newCollection=$recv($OrderedCollection())._new(); -$2=self._collectionWithDuplicates(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithDuplicates"]=1; -//>>excludeEnd("ctx"); -$recv($2)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(newCollection)._add_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)} +return $InliningCodeGenerator(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection", -referencedClasses: ["OrderedCollection"], -//>>excludeEnd("ide"); -messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"] +source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator", +referencedClasses: ["InliningCodeGenerator"], +messageSends: [] }), -$globals.CollectionTest); +$globals.InliningCodeGeneratorTest); + + +$core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testIfEmptyFamily", +selector: "testClassRefVar", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28; -$3=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3,$4; +$1=$recv($VariableNode())._new(); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._ifEmpty_((function(){ -return (42); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifEmpty:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(42)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._ifEmpty_((function(){ -return (42); - -})); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,$6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$9=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=2; -//>>excludeEnd("ctx"); -$8=$recv($9)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$recv($1)._value_("Object"); +$2=$recv($1)._yourself(); +node=$2; +$3=$recv($SemanticAnalyzer())._new(); $ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$7=$recv($8)._ifNotEmpty_((function(){ -return (42); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifNotEmpty:"]=1; -//>>excludeEnd("ctx"); -$11=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=3; -//>>excludeEnd("ctx"); -$10=$recv($11)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($7,$10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$13=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$12=$recv($13)._ifNotEmpty_((function(){ -return (42); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifNotEmpty:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($12,(42)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$15=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$14=$recv($15)._ifNotEmpty_((function(col){ -return col; - -})); -$16=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($14,$16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$19=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=4; -//>>excludeEnd("ctx"); -$18=$recv($19)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -$17=$recv($18)._ifEmpty_ifNotEmpty_((function(){ -return (42); - -}),(function(){ -return (999); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($17,(42)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -$21=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=6; -//>>excludeEnd("ctx"); -$20=$recv($21)._ifEmpty_ifNotEmpty_((function(){ -return (42); - -}),(function(){ -return (999); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($20,(999)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=7; -//>>excludeEnd("ctx"); -$23=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=7; -//>>excludeEnd("ctx"); -$22=$recv($23)._ifEmpty_ifNotEmpty_((function(){ -return (42); - -}),(function(col){ -return col; - -})); -$24=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=8; -//>>excludeEnd("ctx"); -self._assert_equals_($22,$24); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=8; -//>>excludeEnd("ctx"); -$25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){ -return (42); - -}),(function(){ -return (999); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($25,(999)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=9; -//>>excludeEnd("ctx"); -$27=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=9; -//>>excludeEnd("ctx"); -$26=$recv($27)._ifNotEmpty_ifEmpty_((function(){ -return (42); - -}),(function(){ -return (999); - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($26,(42)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=10; -//>>excludeEnd("ctx"); -$29=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=10; -//>>excludeEnd("ctx"); -$28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){ -return col; - -}),(function(){ -return (999); - -})); -self._assert_equals_($28,self._collection()); +$recv($3)._pushScope_($recv($MethodLexicalScope())._new()); +$4=$recv($3)._visit_(node); +self._assert_($recv($recv(node)._binding())._isClassRefVar()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"] +source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar", +referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"], +messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"] }), -$globals.CollectionTest); +$globals.ScopeVarTest); $core.addMethod( $core.method({ -selector: "testIsEmpty", +selector: "testInstanceVar", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node,scope; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._collectionClass())._new())._isEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isEmpty"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -self._deny_($recv(self._collection())._isEmpty()); +var $1,$2; +$1=$recv($VariableNode())._new(); +$ctx1.sendIdx["new"]=1; +$recv($1)._value_("bzzz"); +$2=$recv($1)._yourself(); +node=$2; +scope=$recv($MethodLexicalScope())._new(); +$recv(scope)._addIVar_("bzzz"); +self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"] +source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar", +referencedClasses: ["VariableNode", "MethodLexicalScope"], +messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"] }), -$globals.CollectionTest); +$globals.ScopeVarTest); $core.addMethod( $core.method({ -selector: "testNoneSatisfy", +selector: "testPseudoVar", protocol: 'tests', fn: function (){ var self=this; -var anyOne; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node,pseudoVars; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2; -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -anyOne=$recv($1)._anyOne(); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$2=$recv($3)._noneSatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +pseudoVars=["self", "super", "true", "false", "nil"]; +$recv(pseudoVars)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__eq(anyOne); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=$recv($VariableNode())._new(); +$ctx2.sendIdx["new"]=1; +$recv($1)._value_(each); +$2=$recv($1)._yourself(); +node=$2; +node; +return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["noneSatisfy:"]=1; -//>>excludeEnd("ctx"); -self._deny_($2); -self._assert_($recv(self._collection())._noneSatisfy_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__eq($recv($Object())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -}))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"] +source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]", +referencedClasses: ["VariableNode", "MethodLexicalScope"], +messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"] }), -$globals.CollectionTest); +$globals.ScopeVarTest); $core.addMethod( $core.method({ -selector: "testRemoveAll", +selector: "testTempVar", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node,scope; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; -$1=self._collection(); -$recv($1)._removeAll(); +$1=$recv($VariableNode())._new(); +$ctx1.sendIdx["new"]=1; +$recv($1)._value_("bzzz"); $2=$recv($1)._yourself(); -self._assert_equals_($2,$recv(self._collectionClass())._new()); +node=$2; +scope=$recv($MethodLexicalScope())._new(); +$recv(scope)._addTemp_("bzzz"); +self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"] +source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar", +referencedClasses: ["VariableNode", "MethodLexicalScope"], +messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"] }), -$globals.CollectionTest); +$globals.ScopeVarTest); $core.addMethod( $core.method({ -selector: "testSelect", +selector: "testUnknownVar", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var node; +function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} +function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._select_((function(){ -return false; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["select:"]=1; -//>>excludeEnd("ctx"); -$4=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +$1=$recv($VariableNode())._new(); $ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._select_((function(){ -return true; +$recv($1)._value_("bzzz"); +$2=$recv($1)._yourself(); +node=$2; +self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)}); +}, +args: [], +source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil", +referencedClasses: ["VariableNode", "MethodLexicalScope"], +messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"] +}), +$globals.ScopeVarTest); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["select:"]=2; -//>>excludeEnd("ctx"); -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$9=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$8=$recv($9)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$10=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -return $recv(each).__eq($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["select:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($8,self._sampleNewValueAsCollection()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$12=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=2; -//>>excludeEnd("ctx"); -$11=$recv($12)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$13=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -return $recv(each).__tild_eq($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["~="]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["select:"]=4; -//>>excludeEnd("ctx"); -$14=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($11,$14); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$16=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=5; -//>>excludeEnd("ctx"); -$15=$recv($16)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$17=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=3; -//>>excludeEnd("ctx"); -return $recv(each).__eq($17); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["select:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($15,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(each).__tild_eq(self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); -//>>excludeEnd("ctx"); -})),self._collection()); + + +$core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests'); +$core.addMethod( +$core.method({ +selector: "setUp", +protocol: 'running', +fn: function (){ +var self=this; +function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +return $core.withContext(function($ctx1) { +self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="] +source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object", +referencedClasses: ["SemanticAnalyzer", "Object"], +messageSends: ["on:"] }), -$globals.CollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testSize", +selector: "testAssignment", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($recv(self._collectionClass())._new())._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(self._sampleNewValueAsCollection())._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["size"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collection())._size(),self._collectionSize()); +src="foo self := 1"; +ast=$recv($Smalltalk())._parse_(src); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$InvalidAssignmentError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"] +source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError", +referencedClasses: ["Smalltalk", "InvalidAssignmentError"], +messageSends: ["parse:", "should:raise:", "visit:"] }), -$globals.CollectionTest); - +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'fixture', +selector: "testNonLocalReturn", +protocol: 'tests', fn: function (){ var self=this; -return nil; - +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +src="foo | a | a + 1. ^ a"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"] }), -$globals.CollectionTest.klass); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "isAbstract", -protocol: 'testing', +selector: "testNonLocalReturn2", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._collectionClass())._isNil(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)}); -//>>excludeEnd("ctx"); +src="foo | a | a + 1. [ [ ^ a] ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isAbstract\x0a\x09^ self collectionClass isNil", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isNil", "collectionClass"] +source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"] }), -$globals.CollectionTest.klass); - +$globals.SemanticAnalyzerTest); -$core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', +selector: "testScope", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $4,$3,$2,$1; +src="foo | a | a + 1. [ | b | b := a ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +$4=$recv($recv($recv(ast)._nodes())._first())._nodes(); +$ctx1.sendIdx["nodes"]=1; +$3=$recv($4)._last(); +$2=$recv($3)._scope(); +$ctx1.sendIdx["scope"]=1; +$1=$recv($2).__eq_eq($recv(ast)._scope()); +self._deny_($1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "sampleNewIndex", -protocol: 'fixture', +selector: "testScope2", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $8,$7,$6,$5,$4,$3,$2,$1; +src="foo | a | a + 1. [ [ | b | b := a ] ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +$8=$recv($recv($recv(ast)._nodes())._first())._nodes(); +$ctx1.sendIdx["nodes"]=3; +$7=$recv($8)._last(); +$6=$recv($7)._nodes(); +$ctx1.sendIdx["nodes"]=2; +$5=$recv($6)._first(); +$ctx1.sendIdx["first"]=2; +$4=$recv($5)._nodes(); +$ctx1.sendIdx["nodes"]=1; +$3=$recv($4)._first(); +$ctx1.sendIdx["first"]=1; +$2=$recv($3)._scope(); +$ctx1.sendIdx["scope"]=1; +$1=$recv($2).__eq_eq($recv(ast)._scope()); +self._deny_($1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "sampleNonIndexesDo:", -protocol: 'fixture', -fn: function (aBlock){ +selector: "testScopeLevel", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3; +src="foo | a | a + 1. [ [ | b | b := a ] ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +$2=$recv(ast)._scope(); +$ctx1.sendIdx["scope"]=1; +$1=$recv($2)._scopeLevel(); +$ctx1.sendIdx["scopeLevel"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$10=$recv($recv($recv(ast)._nodes())._first())._nodes(); +$ctx1.sendIdx["nodes"]=3; +$9=$recv($10)._last(); +$8=$recv($9)._nodes(); +$ctx1.sendIdx["nodes"]=2; +$7=$recv($8)._first(); +$ctx1.sendIdx["first"]=2; +$6=$recv($7)._nodes(); +$ctx1.sendIdx["nodes"]=1; +$5=$recv($6)._first(); +$ctx1.sendIdx["first"]=1; +$4=$recv($5)._scope(); +$3=$recv($4)._scopeLevel(); +self._assert_equals_($3,(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +args: [], +source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ +selector: "testUnknownVariables", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +src="foo | a | b + a"; +ast=$recv($Smalltalk())._parse_(src); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$UnknownVariableError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +args: [], +source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError", +referencedClasses: ["Smalltalk", "UnknownVariableError"], +messageSends: ["parse:", "should:raise:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAt", +selector: "testUnknownVariablesWithScope", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._nonIndexesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -return $recv($1)._at_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]"; +ast=$recv($Smalltalk())._parse_(src); +self._should_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(self._collection())._at_(index),value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$UnknownVariableError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"] +source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError", +referencedClasses: ["Smalltalk", "UnknownVariableError"], +messageSends: ["parse:", "should:raise:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAtIfAbsent", +selector: "testVariableShadowing", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3; -self._nonIndexesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._at_ifAbsent_(each,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -$3=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_($1,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)}); -//>>excludeEnd("ctx"); -})),value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); +src="foo | a | a + 1"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"] +source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAtIfAbsentPut", +selector: "testVariableShadowing2", protocol: 'tests', fn: function (){ var self=this; -var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -newCollection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:ifAbsentPut:"]=1; -//>>excludeEnd("ctx"); -return self._assert_equals_($1,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_(newCollection,self._collection()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +src="foo | a | a + 1. [ | a | a := 2 ]"; +ast=$recv($Smalltalk())._parse_(src); +self._should_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -})),self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_(newCollection,self._collectionWithNewValue()); +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$ShadowingVariableError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"] +source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError", +referencedClasses: ["Smalltalk", "ShadowingVariableError"], +messageSends: ["parse:", "should:raise:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAtIfPresent", +selector: "testVariableShadowing3", protocol: 'tests', fn: function (){ var self=this; -var visited,sentinel; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3; -sentinel=$recv($Object())._new(); -self._nonIndexesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -visited=nil; -visited; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._at_ifPresent_(each,(function(value1){ -visited=value1; -visited; -return sentinel; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:ifPresent:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -return self._assert_($recv(visited)._isNil()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -visited=nil; -visited; -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._at_ifPresent_(index,(function(value2){ -visited=value2; -visited; -return sentinel; - -})); -self._assert_equals_($3,sentinel); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_(visited,$recv(self._collection())._at_(index)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); +src="foo | a | a + 1. [ | b | b := 2 ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"] +source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAtIfPresentIfAbsent", +selector: "testVariableShadowing4", protocol: 'tests', fn: function (){ var self=this; -var visited,sentinel; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$5,$4; -sentinel=$recv($Object())._new(); -self._nonIndexesDo_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -visited=nil; -visited; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){ -visited=value1; -visited; -return sentinel; - -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -$3=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -return self._assert_($recv(visited)._isNil()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -visited=nil; -visited; -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){ -visited=value2; -visited; -return sentinel; - -}),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_($4,sentinel); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_(visited,$recv(self._collection())._at_(index)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)}); -//>>excludeEnd("ctx"); -})); +src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"] +source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testAtPut", +selector: "testVariableShadowing5", protocol: 'tests', fn: function (){ var self=this; -var newCollection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -newCollection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]"; +ast=$recv($Smalltalk())._parse_(src); +self._should_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(newCollection)._at_put_(index,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_(newCollection,self._collection()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue()); -self._assert_equals_(newCollection,self._collectionWithNewValue()); +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$ShadowingVariableError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"] +source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError", +referencedClasses: ["Smalltalk", "ShadowingVariableError"], +messageSends: ["parse:", "should:raise:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testEquality", +selector: "testVariablesLookup", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8; -$2=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$4=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$7=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($7,self._collectionWithNewValue()); -$10=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10)._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$11=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$8=$recv($9).__eq($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new())); +var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28; +src="foo | a | a + 1. [ | b | b := a ]"; +ast=$recv($Smalltalk())._parse_(src); +$recv(self["@analyzer"])._visit_(ast); +$7=$recv(ast)._nodes(); +$ctx1.sendIdx["nodes"]=2; +$6=$recv($7)._first(); +$ctx1.sendIdx["first"]=2; +$5=$recv($6)._nodes(); +$ctx1.sendIdx["nodes"]=1; +$4=$recv($5)._first(); +$ctx1.sendIdx["first"]=1; +$3=$recv($4)._receiver(); +$ctx1.sendIdx["receiver"]=1; +$2=$recv($3)._binding(); +$ctx1.sendIdx["binding"]=1; +$1=$recv($2)._isTempVar(); +$ctx1.sendIdx["isTempVar"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$15=$recv(ast)._nodes(); +$ctx1.sendIdx["nodes"]=4; +$14=$recv($15)._first(); +$ctx1.sendIdx["first"]=4; +$13=$recv($14)._nodes(); +$ctx1.sendIdx["nodes"]=3; +$12=$recv($13)._first(); +$ctx1.sendIdx["first"]=3; +$11=$recv($12)._receiver(); +$10=$recv($11)._binding(); +$ctx1.sendIdx["binding"]=2; +$9=$recv($10)._scope(); +$ctx1.sendIdx["scope"]=1; +$16=$recv(ast)._scope(); +$ctx1.sendIdx["scope"]=2; +$8=$recv($9).__eq_eq($16); +$ctx1.sendIdx["=="]=1; +self._assert_($8); +$ctx1.sendIdx["assert:"]=2; +$27=$recv(ast)._nodes(); +$ctx1.sendIdx["nodes"]=8; +$26=$recv($27)._first(); +$ctx1.sendIdx["first"]=7; +$25=$recv($26)._nodes(); +$ctx1.sendIdx["nodes"]=7; +$24=$recv($25)._last(); +$ctx1.sendIdx["last"]=1; +$23=$recv($24)._nodes(); +$ctx1.sendIdx["nodes"]=6; +$22=$recv($23)._first(); +$ctx1.sendIdx["first"]=6; +$21=$recv($22)._nodes(); +$ctx1.sendIdx["nodes"]=5; +$20=$recv($21)._first(); +$ctx1.sendIdx["first"]=5; +$19=$recv($20)._left(); +$ctx1.sendIdx["left"]=1; +$18=$recv($19)._binding(); +$ctx1.sendIdx["binding"]=3; +$17=$recv($18)._isTempVar(); +self._assert_($17); +$ctx1.sendIdx["assert:"]=3; +$39=$recv(ast)._nodes(); +$ctx1.sendIdx["nodes"]=12; +$38=$recv($39)._first(); +$ctx1.sendIdx["first"]=10; +$37=$recv($38)._nodes(); +$ctx1.sendIdx["nodes"]=11; +$36=$recv($37)._last(); +$ctx1.sendIdx["last"]=2; +$35=$recv($36)._nodes(); +$ctx1.sendIdx["nodes"]=10; +$34=$recv($35)._first(); +$ctx1.sendIdx["first"]=9; +$33=$recv($34)._nodes(); +$ctx1.sendIdx["nodes"]=9; +$32=$recv($33)._first(); +$ctx1.sendIdx["first"]=8; +$31=$recv($32)._left(); +$30=$recv($31)._binding(); +$29=$recv($30)._scope(); +$ctx1.sendIdx["scope"]=3; +$42=$recv($recv($recv(ast)._nodes())._first())._nodes(); +$ctx1.sendIdx["nodes"]=13; +$41=$recv($42)._last(); +$40=$recv($41)._scope(); +$28=$recv($29).__eq_eq($40); +self._assert_($28); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="] +source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.", +referencedClasses: ["Smalltalk"], +messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"] }), -$globals.IndexableCollectionTest); +$globals.SemanticAnalyzerTest); -$core.addMethod( -$core.method({ -selector: "testIndexOf", -protocol: 'tests', -fn: function (){ -var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -return $recv($1)._indexOf_(self._sampleNewValue()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["indexOf:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(self._collection())._indexOf_(value),index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"] -}), -$globals.IndexableCollectionTest); + +$core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testIndexOfWithNull", -protocol: 'tests', +selector: "setUp", +protocol: 'running', fn: function (){ var self=this; -var jsNull; -function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)} +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -jsNull=$recv($JSON())._parse_("null"); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._collection(); -$recv($1)._at_put_(index,jsNull); -$2=$recv($1)._indexOf_(jsNull); -return self._assert_equals_($2,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1,$2,$4,$5,$3,$6; +$1=$recv($AISemanticAnalyzer())._on_($Object()); +$2=$1; +$4=$recv($AIContext())._new(); +$recv($4)._defineLocal_("local"); +$recv($4)._localAt_put_("local",(3)); +$5=$recv($4)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$3=$5; +$recv($2)._context_($3); +$6=$recv($1)._yourself(); +self["@analyzer"]=$6; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]", -referencedClasses: ["JSON"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"] +source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", +referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"], +messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"] }), -$globals.IndexableCollectionTest); +$globals.AISemanticAnalyzerTest); $core.addMethod( $core.method({ -selector: "testWithIndexDo", +selector: "testContextVariables", protocol: 'tests', fn: function (){ var self=this; -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var src,ast; +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -collection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$recv(self._collection())._withIndexDo_((function(each,index){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +src="foo | a | local + a"; +ast=$recv($Smalltalk())._parse_(src); +self._shouldnt_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(collection)._at_(index),each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +return $recv(self["@analyzer"])._visit_(ast); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$UnknownVariableError()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"] +source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError", +referencedClasses: ["Smalltalk", "UnknownVariableError"], +messageSends: ["parse:", "shouldnt:raise:", "visit:"] }), -$globals.IndexableCollectionTest); +$globals.AISemanticAnalyzerTest); +}); -$core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests'); +define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){ +var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; +$core.addPackage('Kernel-Tests'); +$core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); }; +$core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"}; + +$core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionKeys", -protocol: 'fixture', +selector: "testAddExtensionMethod", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var method,dirty; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10; +$2=self._class(); +$ctx1.sendIdx["class"]=1; +$1=$recv($2)._package(); +$ctx1.sendIdx["package"]=1; +dirty=$recv($1)._isDirty(); +$ctx1.sendIdx["isDirty"]=1; +$4=self._class(); +$ctx1.sendIdx["class"]=2; +$3=$recv($4)._package(); +$ctx1.sendIdx["package"]=2; +$recv($3)._beClean(); +$5=self._class(); +$ctx1.sendIdx["class"]=3; +method=$recv($5)._compile_protocol_("doNothing","**not-a-package"); +$8=self._class(); +$ctx1.sendIdx["class"]=4; +$7=$recv($8)._package(); +$ctx1.sendIdx["package"]=3; +$6=$recv($7)._isDirty(); +self._deny_($6); +$9=self._class(); +$ctx1.sendIdx["class"]=5; +$recv($9)._removeCompiledMethod_(method); +$10=dirty; +if($core.assert($10)){ +$recv($recv(self._class())._package())._beDirty(); +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionKeys\x0a\x09self subclassResponsibility", +source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"] }), -$globals.AssociativeCollectionTest); +$globals.AnnouncementSubscriptionTest); $core.addMethod( $core.method({ -selector: "collectionValues", -protocol: 'fixture', +selector: "testHandlesAnnouncement", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var subscription,announcementClass1,announcementClass2,classBuilder; +function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} +function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} +function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $1,$2; +classBuilder=$recv($ClassBuilder())._new(); +$ctx1.sendIdx["new"]=1; +announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests"); +subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement()); +$1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement()); +$ctx1.sendIdx["handlesAnnouncement:"]=1; +self._assert_equals_($1,true); +$ctx1.sendIdx["assert:equals:"]=1; +$2=$recv(subscription)._handlesAnnouncement_(announcementClass1); +$ctx1.sendIdx["handlesAnnouncement:"]=2; +self._assert_equals_($2,true); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false); +$recv(classBuilder)._basicRemoveClass_(announcementClass1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionValues\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.", +referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"], +messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"] }), -$globals.AssociativeCollectionTest); +$globals.AnnouncementSubscriptionTest); -$core.addMethod( -$core.method({ -selector: "nonIndexesDo:", -protocol: 'fixture', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value_("z"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:"] -}), -$globals.AssociativeCollectionTest); + +$core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "sampleNewIndex", -protocol: 'fixture', +selector: "testOnDo", +protocol: 'tests', fn: function (){ var self=this; -return "new"; - +var counter,announcer; +function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} +function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} +return $core.withContext(function($ctx1) { +var $1,$2; +counter=(0); +announcer=$recv($Announcer())._new(); +$ctx1.sendIdx["new"]=1; +$recv(announcer)._on_do_($SystemAnnouncement(),(function(){ +return $core.withContext(function($ctx2) { +counter=$recv(counter).__plus((1)); +return counter; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$1=announcer; +$2=$recv($SystemAnnouncement())._new(); +$ctx1.sendIdx["new"]=2; +$recv($1)._announce_($2); +$ctx1.sendIdx["announce:"]=1; +self._assert_equals_(counter,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); +self._assert_equals_(counter,(2)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewIndex\x0a\x09^ 'new'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.", +referencedClasses: ["Announcer", "SystemAnnouncement"], +messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"] }), -$globals.AssociativeCollectionTest); +$globals.AnnouncerTest); $core.addMethod( $core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ +selector: "testOnDoFor", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var counter,announcer; +function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} +function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value_value_("a",(2)); +var $1,$2,$3,$4; +counter=(0); +announcer=$recv($Announcer())._new(); +$ctx1.sendIdx["new"]=1; +$recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){ +return $core.withContext(function($ctx2) { +counter=$recv(counter).__plus((1)); +return counter; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),self); +$1=announcer; +$2=$recv($SystemAnnouncement())._new(); +$ctx1.sendIdx["new"]=2; +$recv($1)._announce_($2); +$ctx1.sendIdx["announce:"]=1; +self._assert_equals_(counter,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$3=announcer; +$4=$recv($SystemAnnouncement())._new(); +$ctx1.sendIdx["new"]=3; +$recv($3)._announce_($4); +$ctx1.sendIdx["announce:"]=2; +self._assert_equals_(counter,(2)); +$ctx1.sendIdx["assert:equals:"]=2; +$recv(announcer)._unsubscribe_(self); +$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); +self._assert_equals_(counter,(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:value:"] +args: [], +source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.", +referencedClasses: ["Announcer", "SystemAnnouncement"], +messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"] }), -$globals.AssociativeCollectionTest); +$globals.AnnouncerTest); $core.addMethod( $core.method({ -selector: "testAddAll", +selector: "testOnDoOnce", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var counter,announcer; +function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)} +function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$3=$2; -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$recv($3)._addAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=1; -//>>excludeEnd("ctx"); -$5=$recv($2)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$1=$5; -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +counter=(0); +announcer=$recv($Announcer())._new(); +$ctx1.sendIdx["new"]=1; +$recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){ +return $core.withContext(function($ctx2) { +counter=$recv(counter).__plus((1)); +return counter; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$1=announcer; +$2=$recv($SystemAnnouncement())._new(); +$ctx1.sendIdx["new"]=2; +$recv($1)._announce_($2); +$ctx1.sendIdx["announce:"]=1; +self._assert_equals_(counter,(1)); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$8=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$9=$8; -$10=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$recv($9)._addAll_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=2; -//>>excludeEnd("ctx"); -$11=$recv($8)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$7=$11; -$12=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($7,$12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$14=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=3; -//>>excludeEnd("ctx"); -$recv($14)._addAll_(self._collection()); -$15=$recv($14)._yourself(); -$13=$15; -self._assert_equals_($13,self._collectionWithNewValue()); +$recv(announcer)._announce_($recv($SystemAnnouncement())._new()); +self._assert_equals_(counter,(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"] +source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.", +referencedClasses: ["Announcer", "SystemAnnouncement"], +messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"] }), -$globals.AssociativeCollectionTest); +$globals.AnnouncerTest); + + +$core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAsDictionary", -protocol: 'tests', +selector: "localReturnOnDoCatch", +protocol: 'fixture', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary())); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +var $early={}; +try { +$recv((function(){ +throw $early=[(2)]; + +}))._on_do_($Error(),(function(){ + +})); +return (3); +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"] +source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3", +referencedClasses: ["Error"], +messageSends: ["on:do:"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testAsHashedCollection", -protocol: 'tests', +selector: "localReturnOnDoMiss", +protocol: 'fixture', fn: function (){ var self=this; -function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection())); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +var $early={}; +try { +$recv((function(){ +throw $early=[(2)]; + +}))._on_do_($Class(),(function(){ + +})); +return (3); +} +catch(e) {if(e===$early)return e[0]; throw e} +}, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).", -referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"] +source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3", +referencedClasses: ["Class"], +messageSends: ["on:do:"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testComma", +selector: "testCanClearInterval", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$7=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6).__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$8=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$10=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10).__comma(self._collection()); -self._assert_equals_($9,self._collectionWithNewValue()); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv((function(){ +return $core.withContext(function($ctx3) { +return $recv($recv($Error())._new())._signal(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}))._valueWithInterval_((0)))._clearInterval(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"] +source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testFrom", +selector: "testCanClearTimeout", protocol: 'tests', fn: function (){ var self=this; -var associations; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1="a".__minus_gt((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=1; -//>>excludeEnd("ctx"); -associations=[$1,"b".__minus_gt((2))]; -self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)])); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv((function(){ +return $core.withContext(function($ctx3) { +return $recv($recv($Error())._new())._signal(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}))._valueWithTimeout_((0)))._clearTimeout(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"] +source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testKeys", +selector: "testCompiledSource", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$4; -$2=$recv($recv(self._collectionClass())._new())._keys(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["keys"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isEmpty(); -self._assert_($1); -$3=$recv(self._collection())._keys(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["keys"]=2; -//>>excludeEnd("ctx"); -$4=self._collectionKeys(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionKeys"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($3,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assertSameContents:as:"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()])); +self._assert_($recv($recv((function(){ +return $core.withContext(function($ctx2) { +return (1).__plus((1)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._compiledSource())._includesSubString_("function")); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }", +source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"] +messageSends: ["assert:", "includesSubString:", "compiledSource", "+"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testNewFromPairs", +selector: "testCurrySelf", protocol: 'tests', fn: function (){ var self=this; -var flattenedAssociations; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var curriedMethod,array; +function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -flattenedAssociations=["a",(1),"b",(2)]; -self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)])); +curriedMethod=$recv($recv((function(selfarg,x){ +return $core.withContext(function($ctx2) { +return $recv(selfarg)._at_(x); +}, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)}); +}))._currySelf())._asCompiledMethod_("foo:"); +array=[(3), (1), (4)]; +$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper"); +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._assert_equals_($recv(array)._foo_((2)),(1)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}))._ensure_((function(){ +return $core.withContext(function($ctx2) { +return $recv($Array())._removeCompiledMethod_(curriedMethod); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"] +source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]", +referencedClasses: ["ClassBuilder", "Array"], +messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testPrintString", +selector: "testEnsure", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$4,$1,$5; -$3=self._collectionClass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionClass"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._new(); -$recv($2)._at_put_("firstname","James"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("lastname","Bond"); -$4=$recv($2)._printString(); -$1=$4; -$5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$5); +self._assert_equals_($recv((function(){ +return (3); + +}))._ensure_((function(){ +return (4); + +})),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'", +source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"] +messageSends: ["assert:equals:", "ensure:"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testRemoveKey", +selector: "testEnsureRaises", protocol: 'tests', fn: function (){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$6,$4,$7,$8; -self._nonIndexesDo_((function(each){ -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -collection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -collection; self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $core.withContext(function($ctx2) { +return $recv((function(){ return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return $recv(collection)._removeKey_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["removeKey:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv($recv($Error())._new())._signal(); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -$1=collection; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_($1,$2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -collection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -collection; -$3=$recv(collection)._removeKey_(index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["removeKey:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$5=collection; -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq($6); -return self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)}); -//>>excludeEnd("ctx"); +}))._ensure_((function(){ +return true; + })); -$7=self._collectionWithNewValue(); -$recv($7)._removeKey_(self._sampleNewIndex()); -$8=$recv($7)._yourself(); -self._assert_equals_($8,self._collection()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection", +source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error", referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"] +messageSends: ["should:raise:", "ensure:", "signal", "new"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testRemoveKeyIfAbsent", +selector: "testExceptionSemantics", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10; -self._nonIndexesDo_((function(each){ -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._timeout_((100)); +$recv(self._async_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -collection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -collection; -$1=$recv(collection)._removeKey_ifAbsent_(each,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv((function(){ return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx3.sendIdx["sampleNewValue"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._assert_(true); +$recv($Error())._signal(); +self._deny_(true); +return self._finished(); +$ctx3.sendIdx["finished"]=1; }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["removeKey:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -$2=self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["sampleNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=collection; -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_($3,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._samplesDo_((function(index,value){ -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -collection=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -collection; -$5=$recv(collection)._removeKey_ifAbsent_(index,(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +}))._on_do_($Error(),(function(ex){ return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); -return self._sampleNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["removeKey:ifAbsent:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$7=collection; -$8=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$6=$recv($7).__eq($8); -return self._deny_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$9=self._collectionWithNewValue(); -$recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); +return self._finished(); +}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)}); })); -$10=$recv($9)._yourself(); -self._assert_equals_($10,self._collection()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})))._valueWithTimeout_((0)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"] +source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0", +referencedClasses: ["Error"], +messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"] }), -$globals.AssociativeCollectionTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testValues", +selector: "testLocalReturnOnDoCatch", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$4; -$2=$recv($recv(self._collectionClass())._new())._values(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["values"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isEmpty(); -self._assert_($1); -$3=$recv(self._collection())._values(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["values"]=2; -//>>excludeEnd("ctx"); -$4=self._collectionValues(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionValues"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($3,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assertSameContents:as:"]=1; -//>>excludeEnd("ctx"); -self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()])); +self._assert_equals_(self._localReturnOnDoCatch(),(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }", +source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"] -}), -$globals.AssociativeCollectionTest); - - - -$core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests'); -$core.addMethod( -$core.method({ -selector: "collection", -protocol: 'fixture', -fn: function (){ -var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Dictionary())._new(); -$recv($2)._at_put_((1),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("a",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._at_put_(true,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._at_put_((1).__at((3)),(-4)); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "new", "@", "yourself"] +messageSends: ["assert:equals:", "localReturnOnDoCatch"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "collectionKeys", -protocol: 'fixture', +selector: "testLocalReturnOnDoMiss", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=[(1),"a",true,(1).__at((3))]; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); +self._assert_equals_(self._localReturnOnDoMiss(),(2)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}", +source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["@"] +messageSends: ["assert:equals:", "localReturnOnDoMiss"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testNewWithValues", +protocol: 'tests', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Dictionary())._new(); -$recv($2)._at_put_((1),"1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("a","2"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._at_put_(true,"3"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._at_put_((1).__at((3)),"-4"); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "new", "@", "yourself"] -}), -$globals.DictionaryTest); -$core.addMethod( -$core.method({ -selector: "collectionSize", -protocol: 'fixture', -fn: function (){ -var self=this; -return (4); + function TestConstructor(arg1, arg2, arg3) {} + TestConstructor.prototype.name = 'theTestPrototype'; + + var wrappedConstructor = $recv(TestConstructor); + var result = wrappedConstructor._newWithValues_([1, 2, 3 ]); + self._assert_(result instanceof TestConstructor); + self._assert_equals_(result.name, 'theTestPrototype'); + "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made." + self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);; +return self; +}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09^ 4", +source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "collectionValues", -protocol: 'fixture', +selector: "testNumArgs", +protocol: 'tests', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=[(1),(2),(3),(-4)]; -return $1; +$1=$recv((function(){ + +}))._numArgs(); +$ctx1.sendIdx["numArgs"]=1; +self._assert_equals_($1,(0)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv((function(a,b){ +}))._numArgs(),(2)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionValues\x0a\x09^ {1. 2. 3. -4}", +source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "numArgs"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", -protocol: 'fixture', +selector: "testOnDo", +protocol: 'tests', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Dictionary())._new(); -$recv($2)._at_put_((1),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("a",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._at_put_(true,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._at_put_((4),(-4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=4; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("b",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=5; -//>>excludeEnd("ctx"); -$recv($2)._at_put_((3),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=6; -//>>excludeEnd("ctx"); -$recv($2)._at_put_(false,(12)); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "new", "yourself"] -}), -$globals.DictionaryTest); +self._assert_($recv((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv($Error())._new())._signal(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(ex){ +return true; -$core.addMethod( -$core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', -fn: function (){ -var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Dictionary())._new(); -$recv($2)._at_put_((1),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("a",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._at_put_(true,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._at_put_((1).__at((3)),(-4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=4; -//>>excludeEnd("ctx"); -$recv($2)._at_put_("new","N"); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); +}))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "new", "@", "yourself"] +source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])", +referencedClasses: ["Error"], +messageSends: ["assert:", "on:do:", "signal", "new"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "sampleNewValueAsCollection", -protocol: 'fixture', +selector: "testValue", +protocol: 'tests', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Dictionary())._new(); -$recv($2)._at_put_("new","N"); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["at:put:", "new", "yourself"] -}), -$globals.DictionaryTest); - -$core.addMethod( -$core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aBlock)._value_value_(true,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:value:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value_value_((1).__at((3)),(-4)); +var $1; +$1=$recv((function(){ +return $core.withContext(function($ctx2) { +return (1).__plus((1)); +$ctx2.sendIdx["+"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._value(); +$ctx1.sendIdx["value"]=1; +self._assert_equals_($1,(2)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv((function(x){ +return $core.withContext(function($ctx2) { +return $recv(x).__plus((1)); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)}); +}))._value_((2)),(3)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv((function(x,y){ +return $core.withContext(function($ctx2) { +return $recv(x).__star(y); +}, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)}); +}))._value_value_((2),(4)),(8)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_($recv((function(a,b,c){ +return (1); + +}))._value(),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4", +args: [], +source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["samplesDo:", "value:value:", "@"] +messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testAccessing", +selector: "testValueWithPossibleArguments", protocol: 'tests', fn: function (){ var self=this; -var d; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11; -d=$recv($Dictionary())._new(); -$recv(d)._at_put_("hello","world"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=1; -//>>excludeEnd("ctx"); -$1=$recv(d)._at_("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"world"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(d)._at_ifAbsent_("hello",(function(){ -return nil; +var $1,$2; +$1=$recv((function(){ +return (1); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($2,"world"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +}))._valueWithPossibleArguments_([(3), (4)]); +$ctx1.sendIdx["valueWithPossibleArguments:"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=$recv((function(a){ +return $core.withContext(function($ctx2) { +return $recv(a).__plus((4)); +$ctx2.sendIdx["+"]=1; +}, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)}); +}))._valueWithPossibleArguments_([(3), (4)]); +$ctx1.sendIdx["valueWithPossibleArguments:"]=2; +self._assert_equals_($2,(7)); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){ -return nil; - -}))).__eq("world")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(d)._includesKey_("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includesKey:"]=1; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(d)._includesKey_("foo"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includesKey:"]=2; -//>>excludeEnd("ctx"); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$recv(d)._at_put_((1),(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:put:"]=2; -//>>excludeEnd("ctx"); -$5=$recv(d)._at_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$6=d; -$7=(1).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$recv($6)._at_put_($7,(3)); -$9=d; -$10=(1).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$8=$recv($9)._at_($10); -self._assert_equals_($8,(3)); -$12=d; -$13=(1).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=3; -//>>excludeEnd("ctx"); -$11=$recv($12)._includesKey_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includesKey:"]=3; -//>>excludeEnd("ctx"); -self._assert_($11); -self._deny_($recv(d)._includesKey_((3).__at((1)))); +self._assert_equals_($recv((function(a,b){ +return $core.withContext(function($ctx2) { +return $recv(a).__plus(b); +}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)}); +}))._valueWithPossibleArguments_([(3), (4), (5)]),(7)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"] +source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.", +referencedClasses: [], +messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"] }), -$globals.DictionaryTest); +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "testDynamicDictionaries", +selector: "testWhileFalse", protocol: 'tests', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var i; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1)))); +i=(0); +$recv((function(){ +return $core.withContext(function($ctx2) { +return $recv(i).__gt((5)); +$ctx2.sendIdx[">"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileFalse_((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +$ctx2.sendIdx["+"]=1; +return i; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +self._assert_equals_(i,(6)); +$ctx1.sendIdx["assert:equals:"]=1; +i=(0); +$recv((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +i; +return $recv(i).__gt((5)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +}))._whileFalse(); +self._assert_equals_(i,(6)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asDictionary", "with:", "->"] +source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6", +referencedClasses: [], +messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"] }), -$globals.DictionaryTest); - +$globals.BlockClosureTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'fixture', +selector: "testWhileTrue", +protocol: 'tests', fn: function (){ var self=this; -function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -return $Dictionary(); - +var i; +return $core.withContext(function($ctx1) { +i=(0); +$recv((function(){ +return $core.withContext(function($ctx2) { +return $recv(i).__lt((5)); +$ctx2.sendIdx["<"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._whileTrue_((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +$ctx2.sendIdx["+"]=1; +return i; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +self._assert_equals_(i,(5)); +$ctx1.sendIdx["assert:equals:"]=1; +i=(0); +$recv((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +i; +return $recv(i).__lt((5)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +}))._whileTrue(); +self._assert_equals_(i,(5)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ Dictionary", -referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); -messageSends: [] +source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5", +referencedClasses: [], +messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"] }), -$globals.DictionaryTest.klass); +$globals.BlockClosureTest); -$core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests'); + +$core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collection", -protocol: 'fixture', +selector: "testEquality", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]); -return $1; - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11; +$1=(0).__eq(false); +$ctx1.sendIdx["="]=1; +self._deny_($1); +$ctx1.sendIdx["deny:"]=1; +$2=false.__eq((0)); +$ctx1.sendIdx["="]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=2; +$3="".__eq(false); +$ctx1.sendIdx["="]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=3; +$4=false.__eq(""); +$ctx1.sendIdx["="]=4; +self._deny_($4); +$ctx1.sendIdx["deny:"]=4; +$5=true.__eq(true); +$ctx1.sendIdx["="]=5; +self._assert_($5); +$ctx1.sendIdx["assert:"]=1; +$6=false.__eq(true); +$ctx1.sendIdx["="]=6; +self._deny_($6); +$ctx1.sendIdx["deny:"]=5; +$7=true.__eq(false); +$ctx1.sendIdx["="]=7; +self._deny_($7); +$8=false.__eq(false); +$ctx1.sendIdx["="]=8; +self._assert_($8); +$ctx1.sendIdx["assert:"]=2; +$10=true._yourself(); +$ctx1.sendIdx["yourself"]=1; +$9=$recv($10).__eq(true); +$ctx1.sendIdx["="]=9; +self._assert_($9); +$ctx1.sendIdx["assert:"]=3; +$12=true._yourself(); +$ctx1.sendIdx["yourself"]=2; +$11=$recv($12).__eq(true._yourself()); +self._assert_($11); +return self; +}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }", +source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["deny:", "=", "assert:", "yourself"] }), -$globals.HashedCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionKeys", -protocol: 'fixture', +selector: "testIdentity", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=["b","a","c","d"]; -return $1; - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11; +$1=(0).__eq_eq(false); +$ctx1.sendIdx["=="]=1; +self._deny_($1); +$ctx1.sendIdx["deny:"]=1; +$2=false.__eq_eq((0)); +$ctx1.sendIdx["=="]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=2; +$3="".__eq_eq(false); +$ctx1.sendIdx["=="]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=3; +$4=false.__eq_eq(""); +$ctx1.sendIdx["=="]=4; +self._deny_($4); +$ctx1.sendIdx["deny:"]=4; +$5=true.__eq_eq(true); +$ctx1.sendIdx["=="]=5; +self._assert_($5); +$ctx1.sendIdx["assert:"]=1; +$6=false.__eq_eq(true); +$ctx1.sendIdx["=="]=6; +self._deny_($6); +$ctx1.sendIdx["deny:"]=5; +$7=true.__eq_eq(false); +$ctx1.sendIdx["=="]=7; +self._deny_($7); +$8=false.__eq_eq(false); +$ctx1.sendIdx["=="]=8; +self._assert_($8); +$ctx1.sendIdx["assert:"]=2; +$10=true._yourself(); +$ctx1.sendIdx["yourself"]=1; +$9=$recv($10).__eq_eq(true); +$ctx1.sendIdx["=="]=9; +self._assert_($9); +$ctx1.sendIdx["assert:"]=3; +$12=true._yourself(); +$ctx1.sendIdx["yourself"]=2; +$11=$recv($12).__eq_eq(true._yourself()); +self._assert_($11); +return self; +}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }", +source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["deny:", "==", "assert:", "yourself"] }), -$globals.HashedCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testIfTrueIfFalse", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]); -return $1; - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$7,$8; +if($core.assert(true)){ +$1="alternative block"; +}; +self._assert_equals_($1,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=1; +if(!$core.assert(true)){ +$2="alternative block"; +}; +self._assert_equals_($2,nil); +$ctx1.sendIdx["assert:equals:"]=2; +if($core.assert(false)){ +$3="alternative block"; +}; +self._assert_equals_($3,nil); +$ctx1.sendIdx["assert:equals:"]=3; +if(!$core.assert(false)){ +$4="alternative block"; +}; +self._assert_equals_($4,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=4; +if($core.assert(false)){ +$5="alternative block"; +} else { +$5="alternative block2"; +}; +self._assert_equals_($5,"alternative block2"); +$ctx1.sendIdx["assert:equals:"]=5; +if($core.assert(false)){ +$6="alternative block2"; +} else { +$6="alternative block"; +}; +self._assert_equals_($6,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=6; +if($core.assert(true)){ +$7="alternative block"; +} else { +$7="alternative block2"; +}; +self._assert_equals_($7,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=7; +if($core.assert(true)){ +$8="alternative block2"; +} else { +$8="alternative block"; +}; +self._assert_equals_($8,"alternative block2"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }", +source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"] }), -$globals.HashedCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionSize", -protocol: 'fixture', +selector: "testIfTrueIfFalseWithBoxing", +protocol: 'tests', fn: function (){ var self=this; -return (4); - +return $core.withContext(function($ctx1) { +var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15; +$2=true._yourself(); +$ctx1.sendIdx["yourself"]=1; +if($core.assert($2)){ +$1="alternative block"; +}; +self._assert_equals_($1,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=1; +$4=true._yourself(); +$ctx1.sendIdx["yourself"]=2; +if(!$core.assert($4)){ +$3="alternative block"; +}; +self._assert_equals_($3,nil); +$ctx1.sendIdx["assert:equals:"]=2; +$6=false._yourself(); +$ctx1.sendIdx["yourself"]=3; +if($core.assert($6)){ +$5="alternative block"; +}; +self._assert_equals_($5,nil); +$ctx1.sendIdx["assert:equals:"]=3; +$8=false._yourself(); +$ctx1.sendIdx["yourself"]=4; +if(!$core.assert($8)){ +$7="alternative block"; +}; +self._assert_equals_($7,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=4; +$10=false._yourself(); +$ctx1.sendIdx["yourself"]=5; +if($core.assert($10)){ +$9="alternative block"; +} else { +$9="alternative block2"; +}; +self._assert_equals_($9,"alternative block2"); +$ctx1.sendIdx["assert:equals:"]=5; +$12=false._yourself(); +$ctx1.sendIdx["yourself"]=6; +if($core.assert($12)){ +$11="alternative block2"; +} else { +$11="alternative block"; +}; +self._assert_equals_($11,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=6; +$14=true._yourself(); +$ctx1.sendIdx["yourself"]=7; +if($core.assert($14)){ +$13="alternative block"; +} else { +$13="alternative block2"; +}; +self._assert_equals_($13,"alternative block"); +$ctx1.sendIdx["assert:equals:"]=7; +$16=true._yourself(); +if($core.assert($16)){ +$15="alternative block2"; +} else { +$15="alternative block"; +}; +self._assert_equals_($15,"alternative block2"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09^ 4", +source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"] }), -$globals.HashedCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionValues", -protocol: 'fixture', +selector: "testLogic", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=[(1),(2),(3),(-4)]; -return $1; - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23; +$1=true.__and(true); +$ctx1.sendIdx["&"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=true.__and(false); +$ctx1.sendIdx["&"]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=1; +$3=false.__and(true); +$ctx1.sendIdx["&"]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=2; +$5=false.__and(false); +$ctx1.sendIdx["&"]=4; +$4=self._deny_($5); +$ctx1.sendIdx["deny:"]=3; +$6=true.__or(true); +$ctx1.sendIdx["|"]=1; +self._assert_($6); +$ctx1.sendIdx["assert:"]=2; +$7=true.__or(false); +$ctx1.sendIdx["|"]=2; +self._assert_($7); +$ctx1.sendIdx["assert:"]=3; +$8=false.__or(true); +$ctx1.sendIdx["|"]=3; +self._assert_($8); +$ctx1.sendIdx["assert:"]=4; +$10=false.__or(false); +$ctx1.sendIdx["|"]=4; +$9=self._deny_($10); +$ctx1.sendIdx["deny:"]=4; +$12=(1).__gt((0)); +$ctx1.sendIdx[">"]=1; +$11=true.__and($12); +$ctx1.sendIdx["&"]=5; +self._assert_($11); +$ctx1.sendIdx["assert:"]=5; +$14=(1).__gt((0)); +$ctx1.sendIdx[">"]=2; +$13=$recv($14).__and(false); +$ctx1.sendIdx["&"]=6; +self._deny_($13); +$ctx1.sendIdx["deny:"]=5; +$17=(1).__gt((0)); +$ctx1.sendIdx[">"]=3; +$18=(1).__gt((2)); +$ctx1.sendIdx[">"]=4; +$16=$recv($17).__and($18); +$15=self._deny_($16); +$20=(1).__gt((0)); +$ctx1.sendIdx[">"]=5; +$19=false.__or($20); +$ctx1.sendIdx["|"]=5; +self._assert_($19); +$ctx1.sendIdx["assert:"]=6; +$22=(1).__gt((0)); +$ctx1.sendIdx[">"]=6; +$21=$recv($22).__or(false); +$ctx1.sendIdx["|"]=6; +self._assert_($21); +$ctx1.sendIdx["assert:"]=7; +$25=(1).__gt((0)); +$ctx1.sendIdx[">"]=7; +$24=$recv($25).__or((1).__gt((2))); +$23=self._assert_($24); +return self; +}, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }", +source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:", "&", "deny:", "|", ">"] }), -$globals.HashedCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", -protocol: 'fixture', +selector: "testLogicKeywords", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]); -return $1; - -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.HashedCollectionTest); +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20; +$1=true._and_((function(){ +return true; -$core.addMethod( -$core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', -fn: function (){ -var self=this; -var $1; -$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]); -return $1; +})); +$ctx1.sendIdx["and:"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=true._and_((function(){ +return false; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.HashedCollectionTest); +})); +$ctx1.sendIdx["and:"]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=1; +$3=false._and_((function(){ +return true; -$core.addMethod( -$core.method({ -selector: "sampleNewValueAsCollection", -protocol: 'fixture', -fn: function (){ -var self=this; -var $1; -$1=$globals.HashedCollection._newFromPairs_(["new","N"]); -return $1; +})); +$ctx1.sendIdx["and:"]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=2; +$5=false._and_((function(){ +return false; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.HashedCollectionTest); +})); +$ctx1.sendIdx["and:"]=4; +$4=self._deny_($5); +$ctx1.sendIdx["deny:"]=3; +$6=true._or_((function(){ +return true; -$core.addMethod( -$core.method({ -selector: "testDynamicDictionaries", -protocol: 'tests', -fn: function (){ -var self=this; -function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1)))); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)", -referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"] -}), -$globals.HashedCollectionTest); +})); +$ctx1.sendIdx["or:"]=1; +self._assert_($6); +$ctx1.sendIdx["assert:"]=2; +$7=true._or_((function(){ +return false; +})); +$ctx1.sendIdx["or:"]=2; +self._assert_($7); +$ctx1.sendIdx["assert:"]=3; +$8=false._or_((function(){ +return true; -$core.addMethod( -$core.method({ -selector: "collectionClass", -protocol: 'fixture', -fn: function (){ -var self=this; -function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -return $HashedCollection(); +})); +$ctx1.sendIdx["or:"]=3; +self._assert_($8); +$ctx1.sendIdx["assert:"]=4; +$10=false._or_((function(){ +return false; -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionClass\x0a\x09^ HashedCollection", -referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); -messageSends: [] -}), -$globals.HashedCollectionTest.klass); +})); +$ctx1.sendIdx["or:"]=4; +$9=self._deny_($10); +$ctx1.sendIdx["deny:"]=4; +$11=true._and_((function(){ +return $core.withContext(function($ctx2) { +return (1).__gt((0)); +$ctx2.sendIdx[">"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)}); +})); +$ctx1.sendIdx["and:"]=5; +self._assert_($11); +$ctx1.sendIdx["assert:"]=5; +$13=(1).__gt((0)); +$ctx1.sendIdx[">"]=2; +$12=$recv($13)._and_((function(){ +return false; +})); +$ctx1.sendIdx["and:"]=6; +self._deny_($12); +$ctx1.sendIdx["deny:"]=5; +$16=(1).__gt((0)); +$ctx1.sendIdx[">"]=3; +$15=$recv($16)._and_((function(){ +return $core.withContext(function($ctx2) { +return (1).__gt((2)); +$ctx2.sendIdx[">"]=4; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)}); +})); +$14=self._deny_($15); +$17=false._or_((function(){ +return $core.withContext(function($ctx2) { +return (1).__gt((0)); +$ctx2.sendIdx[">"]=5; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)}); +})); +$ctx1.sendIdx["or:"]=5; +self._assert_($17); +$ctx1.sendIdx["assert:"]=6; +$19=(1).__gt((0)); +$ctx1.sendIdx[">"]=6; +$18=$recv($19)._or_((function(){ +return false; -$core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests'); -$core.addMethod( -$core.method({ -selector: "collectionFirst", -protocol: 'fixture', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +})); +$ctx1.sendIdx["or:"]=6; +self._assert_($18); +$ctx1.sendIdx["assert:"]=7; +$22=(1).__gt((0)); +$ctx1.sendIdx[">"]=7; +$21=$recv($22)._or_((function(){ +return $core.withContext(function($ctx2) { +return (1).__gt((2)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)}); +})); +$20=self._assert_($21); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirst\x0a\x09self subclassResponsibility", +source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +messageSends: ["assert:", "and:", "deny:", "or:", ">"] }), -$globals.SequenceableCollectionTest); +$globals.BooleanTest); $core.addMethod( $core.method({ -selector: "collectionFirstTwo", -protocol: 'fixture', +selector: "testNonBooleanError", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +if($core.assert("")){ +} else { +}; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$NonBooleanReceiver()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirstTwo\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver", +referencedClasses: ["NonBooleanReceiver"], +messageSends: ["should:raise:", "ifTrue:ifFalse:"] }), -$globals.SequenceableCollectionTest); +$globals.BooleanTest); + + +$core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionLast", -protocol: 'fixture', +selector: "setUp", +protocol: 'running', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +self["@builder"]=$recv($ClassBuilder())._new(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionLast\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] +source: "setUp\x0a\x09builder := ClassBuilder new", +referencedClasses: ["ClassBuilder"], +messageSends: ["new"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "collectionLastTwo", -protocol: 'fixture', +selector: "tearDown", +protocol: 'running', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._subclassResponsibility(); +var $1,$receiver; +$1=self["@theClass"]; +if(($receiver = $1) == null || $receiver.isNil){ +$1; +} else { +$recv($Smalltalk())._removeClass_(self["@theClass"]); +self["@theClass"]=nil; +self["@theClass"]; +}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionLastTwo\x0a\x09self subclassResponsibility", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["subclassResponsibility"] -}), -$globals.SequenceableCollectionTest); - -$core.addMethod( -$core.method({ -selector: "nonIndexesDo:", -protocol: 'fixture', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value_($recv(self._collectionSize()).__plus((1))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=2; -//>>excludeEnd("ctx"); -$recv(aBlock)._value_("z"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:", "+", "collectionSize"] -}), -$globals.SequenceableCollectionTest); - -$core.addMethod( -$core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(aBlock)._value_value_((1),self._collectionFirst()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:value:"]=1; -//>>excludeEnd("ctx"); -$recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"] +source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]", +referencedClasses: ["Smalltalk"], +messageSends: ["ifNotNil:", "removeClass:"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "testBeginsWith", +selector: "testClassCopy", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$5,$3,$7,$6; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._beginsWith_($recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["beginsWith:"]=1; -//>>excludeEnd("ctx"); +var $2,$1,$4,$3,$6,$5,$8,$7; +self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); +$2=$recv(self["@theClass"])._superclass(); +$ctx1.sendIdx["superclass"]=1; +$1=$recv($2).__eq_eq($recv($ObjectMock())._superclass()); +$ctx1.sendIdx["=="]=1; self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$3=$recv($4)._beginsWith_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["beginsWith:"]=2; -//>>excludeEnd("ctx"); +$4=$recv(self["@theClass"])._instanceVariableNames(); +$ctx1.sendIdx["instanceVariableNames"]=1; +$3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames()); +$ctx1.sendIdx["=="]=2; self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$6=$recv($7)._beginsWith_(self._collectionFirstTwo()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["beginsWith:"]=3; -//>>excludeEnd("ctx"); -self._assert_($6); -self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo())); +self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2"); +$ctx1.sendIdx["assert:equals:"]=1; +$6=$recv(self["@theClass"])._package(); +$ctx1.sendIdx["package"]=1; +$5=$recv($6).__eq_eq($recv($ObjectMock())._package()); +self._assert_($5); +$8=$recv(self["@theClass"])._methodDictionary(); +$ctx1.sendIdx["methodDictionary"]=1; +$7=$recv($8)._keys(); +$ctx1.sendIdx["keys"]=1; +self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"] +source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys", +referencedClasses: ["ObjectMock"], +messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "testEndsWith", +selector: "testClassMigration", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var instance,oldClass; +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$5,$3,$7,$6; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._endsWith_($recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["endsWith:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10; +oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); +$2=$recv($Smalltalk())._globals(); +$ctx1.sendIdx["globals"]=1; +$1=$recv($2)._at_("ObjectMock2"); +$ctx1.sendIdx["at:"]=1; +instance=$recv($1)._new(); +$4=$recv($Smalltalk())._globals(); +$ctx1.sendIdx["globals"]=2; +$3=$recv($4)._at_("ObjectMock2"); +$ctx1.sendIdx["at:"]=2; +$recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests"); +$5=$recv(oldClass).__eq_eq($ObjectMock2()); +$ctx1.sendIdx["=="]=1; +self._deny_($5); +$ctx1.sendIdx["deny:"]=1; +$6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock()); +$ctx1.sendIdx["=="]=2; +self._assert_($6); $ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$5=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$3=$recv($4)._endsWith_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["endsWith:"]=2; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty()); $ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$6=$recv($7)._endsWith_(self._collectionLastTwo()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["endsWith:"]=3; -//>>excludeEnd("ctx"); -self._assert_($6); -self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo())); +$7=$recv($ObjectMock2())._selectors(); +$ctx1.sendIdx["selectors"]=1; +self._assert_equals_($7,$recv(oldClass)._selectors()); +$ctx1.sendIdx["assert:equals:"]=1; +$8=$recv($ObjectMock2())._comment(); +$ctx1.sendIdx["comment"]=1; +self._assert_equals_($8,$recv(oldClass)._comment()); +$ctx1.sendIdx["assert:equals:"]=2; +$9=$recv($recv($ObjectMock2())._package())._name(); +$ctx1.sendIdx["name"]=1; +self._assert_equals_($9,"Kernel-Tests"); +$11=$recv(instance)._class(); +$ctx1.sendIdx["class"]=1; +$10=$recv($11).__eq_eq($ObjectMock2()); +self._deny_($10); +self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil()); +$recv($Smalltalk())._removeClass_($ObjectMock2()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"] +source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2", +referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"], +messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "testFirst", +selector: "testClassMigrationWithClassInstanceVariables", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} +function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collection())._first(),self._collectionFirst()); +var $1; +$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); +$1=$recv($ObjectMock2())._class(); +$ctx1.sendIdx["class"]=1; +$recv($1)._instanceVariableNames_("foo bar"); +$recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests"); +self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]); +$recv($Smalltalk())._removeClass_($ObjectMock2()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "first", "collection", "collectionFirst"] +source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2", +referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"], +messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "testFirstN", +selector: "testClassMigrationWithSubclasses", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} +function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)} +function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5,$7; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._first_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,self._collectionFirstTwo()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._first_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$5=$recv($6)._first_(self._collectionSize()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first:"]=3; -//>>excludeEnd("ctx"); -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$7); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1,$4,$3; +$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2"); +$recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests"); +$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1; +$recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests"); +$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2; +$recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests"); +$2=$recv($ObjectMock())._subclasses(); +$ctx1.sendIdx["subclasses"]=1; +$1=$recv($2)._includes_($ObjectMock2()); +$ctx1.sendIdx["includes:"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$4=$recv($ObjectMock2())._subclasses(); +$ctx1.sendIdx["subclasses"]=2; +$3=$recv($4)._includes_($ObjectMock3()); +$ctx1.sendIdx["includes:"]=2; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4())); +$recv($recv($ObjectMock())._allSubclasses())._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._collection())._first_((33)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +return $recv($Smalltalk())._removeClass_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"] +source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]", +referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"], +messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); $core.addMethod( $core.method({ -selector: "testFourth", +selector: "testInstanceVariableNames", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._fourth(); -self._assert_equals_($1,$recv(self._collection())._at_((4))); +self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)", +source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "fourth", "collection", "at:"] +messageSends: ["assert:equals:", "instanceVariableNamesFor:"] }), -$globals.SequenceableCollectionTest); +$globals.ClassBuilderTest); + + +$core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testIndexOfStartingAt", -protocol: 'tests', -fn: function (){ +selector: "assertSameContents:as:", +protocol: 'convenience', +fn: function (aCollection,anotherCollection){ var self=this; -var jsNull; -function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$4,$3; -jsNull=$recv($JSON())._parse_("null"); -self._samplesDo_((function(index,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$2=$recv(aCollection)._size(); +$ctx1.sendIdx["size"]=1; +$1=$recv($2).__eq($recv(anotherCollection)._size()); +$ctx1.sendIdx["="]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$recv(aCollection)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._indexOf_startingAt_(value,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["indexOf:startingAt:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._indexOf_startingAt_(value,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["indexOf:startingAt:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); +$4=$recv(aCollection)._occurrencesOf_(each); +$ctx2.sendIdx["occurrencesOf:"]=1; +$3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each)); +return self._assert_($3); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]", -referencedClasses: ["JSON"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"] +args: ["aCollection", "anotherCollection"], +source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]", +referencedClasses: [], +messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"] }), -$globals.SequenceableCollectionTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testIndexOfStartingAtWithNull", -protocol: 'tests', +selector: "collection", +protocol: 'fixture', fn: function (){ var self=this; -var jsNull; -function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -jsNull=$recv($JSON())._parse_("null"); -self._samplesDo_((function(index,value){ -var collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -collection=self._collection(); -collection; -$recv(collection)._at_put_(index,jsNull); -$1=$recv(collection)._indexOf_startingAt_(jsNull,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["indexOf:startingAt:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(collection)._indexOf_startingAt_(jsNull,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["indexOf:startingAt:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,index); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]", -referencedClasses: ["JSON"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"] +source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] }), -$globals.SequenceableCollectionTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testLast", -protocol: 'tests', +selector: "collectionClass", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._collection())._last(),self._collectionLast()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._class())._collectionClass(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast", +source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "last", "collection", "collectionLast"] +messageSends: ["collectionClass", "class"] }), -$globals.SequenceableCollectionTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testLastN", -protocol: 'tests', +selector: "collectionOfPrintStrings", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5,$7; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._last_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,self._collectionLastTwo()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._last_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,$recv(self._collectionClass())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -$5=$recv($6)._last_(self._collectionSize()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last:"]=3; -//>>excludeEnd("ctx"); -$7=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$7); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._collection())._last_((33)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"] +source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] }), -$globals.SequenceableCollectionTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testSecond", -protocol: 'tests', +selector: "collectionSize", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._second(); -self._assert_equals_($1,$recv(self._collection())._at_((2))); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)", +source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "second", "collection", "at:"] +messageSends: ["subclassResponsibility"] }), -$globals.SequenceableCollectionTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testThird", -protocol: 'tests', +selector: "collectionWithDuplicates", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._third(); -self._assert_equals_($1,$recv(self._collection())._at_((3))); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)", +source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "third", "collection", "at:"] +messageSends: ["subclassResponsibility"] }), -$globals.SequenceableCollectionTest); - - +$globals.CollectionTest); -$core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collection", +selector: "collectionWithNewValue", protocol: 'fixture', fn: function (){ var self=this; -var $1; -$1=[(1), (2), (3), (-4)]; -return $1; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09^ #(1 2 3 -4)", +source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionFirst", -protocol: 'fixture', +selector: "isCollectionReadOnly", +protocol: 'testing', fn: function (){ var self=this; -return (1); +return false; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirst\x0a\x09^ 1", +source: "isCollectionReadOnly\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionFirstTwo", +selector: "sampleNewValue", protocol: 'fixture', fn: function (){ var self=this; -var $1; -$1=[(1), (2)]; -return $1; +return "N"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirstTwo\x0a\x09^ #(1 2)", +source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionLast", +selector: "sampleNewValueAsCollection", protocol: 'fixture', fn: function (){ var self=this; -return (-4); - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._collectionClass())._with_(self._sampleNewValue()); +return $1; +}, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionLast\x0a\x09^ -4", +source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["with:", "collectionClass", "sampleNewValue"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionLastTwo", -protocol: 'fixture', +selector: "testAddAll", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=[(3), (-4)]; -return $1; - +return $core.withContext(function($ctx1) { +var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$3=$2; +$5=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$4=$recv($5)._new(); +$ctx1.sendIdx["new"]=1; +$recv($3)._addAll_($4); +$ctx1.sendIdx["addAll:"]=1; +$6=$recv($2)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$1=$6; +$7=self._collection(); +$ctx1.sendIdx["collection"]=2; +self._assert_equals_($1,$7); +$ctx1.sendIdx["assert:equals:"]=1; +$10=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=2; +$9=$recv($10)._new(); +$ctx1.sendIdx["new"]=2; +$11=$9; +$12=self._collection(); +$ctx1.sendIdx["collection"]=3; +$recv($11)._addAll_($12); +$ctx1.sendIdx["addAll:"]=2; +$13=$recv($9)._yourself(); +$ctx1.sendIdx["yourself"]=2; +$8=$13; +$14=self._collection(); +$ctx1.sendIdx["collection"]=4; +self._assert_equals_($8,$14); +$ctx1.sendIdx["assert:equals:"]=2; +$17=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=3; +$16=$recv($17)._new(); +$ctx1.sendIdx["new"]=3; +$18=$16; +$20=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=4; +$19=$recv($20)._new(); +$ctx1.sendIdx["new"]=4; +$recv($18)._addAll_($19); +$ctx1.sendIdx["addAll:"]=3; +$21=$recv($16)._yourself(); +$ctx1.sendIdx["yourself"]=3; +$15=$21; +self._assert_equals_($15,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=3; +$23=self._collection(); +$ctx1.sendIdx["collection"]=5; +$24=$23; +$25=self._sampleNewValueAsCollection(); +$ctx1.sendIdx["sampleNewValueAsCollection"]=1; +$recv($24)._addAll_($25); +$ctx1.sendIdx["addAll:"]=4; +$26=$recv($23)._yourself(); +$ctx1.sendIdx["yourself"]=4; +$22=$26; +$27=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +self._assert_equals_($22,$27); +$28=self._sampleNewValueAsCollection(); +$recv($28)._addAll_(self._collection()); +$29=$recv($28)._yourself(); +self._assertSameContents_as_($29,self._collectionWithNewValue()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionLastTwo\x0a\x09^ #(3 -4)", +source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testAllSatisfy", +protocol: 'tests', fn: function (){ var self=this; +var collection,anyOne; +return $core.withContext(function($ctx1) { var $1; -$1=["1", "2", "3", "-4"]; -return $1; - +collection=self._collection(); +anyOne=$recv(collection)._anyOne(); +$1=$recv(collection)._allSatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(collection)._includes_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["allSatisfy:"]=1; +self._assert_($1); +self._deny_($recv(collection)._allSatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__tild_eq(anyOne); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')", +source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionSize", -protocol: 'fixture', +selector: "testAnyOne", +protocol: 'tests', fn: function (){ var self=this; -return (4); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $core.withContext(function($ctx1) { +var $2,$1; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv(self._collectionClass())._new())._anyOne(); +$ctx2.sendIdx["anyOne"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._includes_($recv(self._collection())._anyOne()); +self._assert_($1); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)}); +}, +args: [], +source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"] +}), +$globals.CollectionTest); +$core.addMethod( +$core.method({ +selector: "testAnySatisfy", +protocol: 'tests', +fn: function (){ +var self=this; +var anyOne; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +return $core.withContext(function($ctx1) { +var $1,$3,$2; +$1=self._collection(); +$ctx1.sendIdx["collection"]=1; +anyOne=$recv($1)._anyOne(); +$3=self._collection(); +$ctx1.sendIdx["collection"]=2; +$2=$recv($3)._anySatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__eq(anyOne); +$ctx2.sendIdx["="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["anySatisfy:"]=1; +self._assert_($2); +self._deny_($recv(self._collection())._anySatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__eq($recv($Object())._new()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09^ 4", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])", +referencedClasses: ["Object"], +messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", -protocol: 'fixture', +selector: "testAsArray", +protocol: 'tests', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=["a", "b", "c", (1), (2), (1), "a"]; -return $1; - +$1=self._collection(); +$ctx1.sendIdx["collection"]=1; +self._assertSameContents_as_($1,$recv(self._collection())._asArray()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')", +source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assertSameContents:as:", "collection", "asArray"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', +selector: "testAsOrderedCollection", +protocol: 'tests', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { var $1; -$1=[(1), (2), (3), (-4), "N"]; -return $1; - +$1=self._collection(); +$ctx1.sendIdx["collection"]=1; +self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')", +source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "sampleNewIndex", -protocol: 'fixture', +selector: "testAsSet", +protocol: 'tests', fn: function (){ var self=this; -return (5); - +var c,set; +return $core.withContext(function($ctx1) { +c=self._collectionWithDuplicates(); +set=$recv(c)._asSet(); +self._assert_equals_($recv(set)._size(),(5)); +$recv(c)._do_((function(each){ +return $core.withContext(function($ctx2) { +return self._assert_($recv(set)._includes_(each)); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewIndex\x0a\x09^ 5", +source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ +selector: "testCollect", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aBlock)._value_value_((3),(3)); +var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._collect_((function(each){ +return each; + +})); +$ctx1.sendIdx["collect:"]=1; +$3=self._collection(); +$ctx1.sendIdx["collection"]=2; +self._assert_equals_($1,$3); +$ctx1.sendIdx["assert:equals:"]=1; +$5=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$4=$recv($5)._collect_((function(each){ +return each; + +})); +$ctx1.sendIdx["collect:"]=2; +self._assert_equals_($4,self._collectionWithNewValue()); +$ctx1.sendIdx["assert:equals:"]=2; +$8=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$7=$recv($8)._new(); +$ctx1.sendIdx["new"]=1; +$6=$recv($7)._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._printString(); +$ctx2.sendIdx["printString"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); +})); +$ctx1.sendIdx["collect:"]=3; +self._assert_equals_($6,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=3; +$11=self._collection(); +$ctx1.sendIdx["collection"]=3; +$10=$recv($11)._collect_((function(){ +return $core.withContext(function($ctx2) { +return self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); +})); +$ctx1.sendIdx["collect:"]=4; +$9=$recv($10)._detect_((function(){ +return true; + +})); +self._assert_equals_($9,self._sampleNewValue()); +$ctx1.sendIdx["assert:equals:"]=4; +self._assert_equals_($recv(self._collection())._collect_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each)._printString(); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); +})),self._collectionOfPrintStrings()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.", +args: [], +source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["samplesDo:", "value:value:"] +messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testAdd", +selector: "testComma", protocol: 'tests', fn: function (){ var self=this; -var array; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=self._collection(); -$recv(array)._add_((6)); -self._assert_equals_($recv(array)._last(),(6)); +var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$4=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$3=$recv($4)._new(); +$ctx1.sendIdx["new"]=1; +$1=$recv($2).__comma($3); +$ctx1.sendIdx[","]=1; +$5=self._collection(); +$ctx1.sendIdx["collection"]=2; +self._assert_equals_($1,$5); +$ctx1.sendIdx["assert:equals:"]=1; +$8=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=2; +$7=$recv($8)._new(); +$ctx1.sendIdx["new"]=2; +$9=self._collection(); +$ctx1.sendIdx["collection"]=3; +$6=$recv($7).__comma($9); +$ctx1.sendIdx[","]=2; +$10=self._collection(); +$ctx1.sendIdx["collection"]=4; +self._assert_equals_($6,$10); +$ctx1.sendIdx["assert:equals:"]=2; +$13=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=3; +$12=$recv($13)._new(); +$ctx1.sendIdx["new"]=3; +$15=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=4; +$14=$recv($15)._new(); +$ctx1.sendIdx["new"]=4; +$11=$recv($12).__comma($14); +$ctx1.sendIdx[","]=3; +self._assert_equals_($11,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=3; +$17=self._collection(); +$ctx1.sendIdx["collection"]=5; +$18=self._sampleNewValueAsCollection(); +$ctx1.sendIdx["sampleNewValueAsCollection"]=1; +$16=$recv($17).__comma($18); +$ctx1.sendIdx[","]=4; +$19=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +self._assert_equals_($16,$19); +self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6", +source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collection", "add:", "assert:equals:", "last"] +messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testAddFirst", +selector: "testDetect", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; +var $1,$2,$3,$4,$6,$5,$7; +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { $1=self._collection(); -$recv($1)._addFirst_((0)); -$2=$recv($1)._yourself(); -self._assert_equals_($recv($2)._first(),(0)); +$ctx2.sendIdx["collection"]=1; +return $recv($1)._detect_((function(){ +return true; + +})); +$ctx2.sendIdx["detect:"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +$2=self._collection(); +$ctx2.sendIdx["collection"]=2; +return $recv($2)._detect_((function(){ +return false; + +})); +$ctx2.sendIdx["detect:"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +}),$Error()); +$ctx1.sendIdx["should:raise:"]=1; +$3=$recv(self._sampleNewValueAsCollection())._detect_((function(){ +return true; + +})); +$ctx1.sendIdx["detect:"]=3; +$4=self._sampleNewValue(); +$ctx1.sendIdx["sampleNewValue"]=1; +self._assert_equals_($3,$4); +$ctx1.sendIdx["assert:equals:"]=1; +$5=$recv(self._collectionWithNewValue())._detect_((function(each){ +return $core.withContext(function($ctx2) { +$6=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +return $recv(each).__eq($6); +$ctx2.sendIdx["="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); +})); +$ctx1.sendIdx["detect:"]=4; +$7=self._sampleNewValue(); +$ctx1.sendIdx["sampleNewValue"]=3; +self._assert_equals_($5,$7); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._collection())._detect_((function(each){ +return $core.withContext(function($ctx3) { +return $recv(each).__eq(self._sampleNewValue()); +}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)}); +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"] +source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error", +referencedClasses: ["Error"], +messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testPrintString", +selector: "testDetectIfNone", protocol: 'tests', fn: function (){ var self=this; -var array; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var sentinel; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$8,$9; -array=$recv($Array())._new(); -$1=$recv(array)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"an Array ()"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10; +sentinel=$recv($Object())._new(); +$3=self._collection(); +$ctx1.sendIdx["collection"]=1; +$2=$recv($3)._detect_ifNone_((function(){ +return true; + +}),(function(){ +return sentinel; + +})); +$ctx1.sendIdx["detect:ifNone:"]=1; +$1=$recv($2).__tild_eq(sentinel); +self._assert_($1); +$5=self._collection(); +$ctx1.sendIdx["collection"]=2; +$4=$recv($5)._detect_ifNone_((function(){ +return false; + +}),(function(){ +return sentinel; + +})); +$ctx1.sendIdx["detect:ifNone:"]=2; +self._assert_equals_($4,sentinel); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=array; -$recv($2)._add_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$3=$recv($2)._add_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$4=$recv(array)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,"an Array (1 3)"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){ +return true; + +}),(function(){ +return sentinel; + +})); +$ctx1.sendIdx["detect:ifNone:"]=3; +$7=self._sampleNewValue(); +$ctx1.sendIdx["sampleNewValue"]=1; +self._assert_equals_($6,$7); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$recv(array)._add_("foo"); -$5=$recv(array)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"an Array (1 3 'foo')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){ +return $core.withContext(function($ctx2) { +$9=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +return $recv(each).__eq($9); +$ctx2.sendIdx["="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)}); +}),(function(){ +return sentinel; + +})); +$ctx1.sendIdx["detect:ifNone:"]=4; +$10=self._sampleNewValue(); +$ctx1.sendIdx["sampleNewValue"]=3; +self._assert_equals_($8,$10); $ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$6=array; -$recv($6)._remove_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["remove:"]=1; -//>>excludeEnd("ctx"); -$7=$recv($6)._remove_((3)); -$8=$recv(array)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($8,"an Array ('foo')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$recv(array)._addLast_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addLast:"]=1; -//>>excludeEnd("ctx"); -$9=$recv(array)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($9,"an Array ('foo' 3)"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$recv(array)._addLast_((3)); -self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)"); +self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__eq(self._sampleNewValue()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)}); +}),(function(){ +return sentinel; + +})),sentinel); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"] +source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel", +referencedClasses: ["Object"], +messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testRemove", +selector: "testDo", protocol: 'tests', fn: function (){ var self=this; -var array; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var newCollection; +function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=[(1), (2), (3), (4), (5)]; -$recv(array)._remove_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["remove:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(array,[(1), (2), (4), (5)]); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +newCollection=$recv($OrderedCollection())._new(); +$ctx1.sendIdx["new"]=1; +$1=self._collection(); +$ctx1.sendIdx["collection"]=1; +$recv($1)._do_((function(each){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(array)._remove_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +return $recv(newCollection)._add_(each); +$ctx2.sendIdx["add:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["do:"]=1; +self._assertSameContents_as_(self._collection(),newCollection); +$ctx1.sendIdx["assertSameContents:as:"]=1; +newCollection=$recv($OrderedCollection())._new(); +$2=self._collectionWithDuplicates(); +$ctx1.sendIdx["collectionWithDuplicates"]=1; +$recv($2)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(newCollection)._add_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +})); +self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["remove:", "assert:equals:", "should:raise:"] +source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection", +referencedClasses: ["OrderedCollection"], +messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testRemoveFromTo", +selector: "testIfEmptyFamily", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["removeFrom:to:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,[(4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28; +$3=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$2=$recv($3)._new(); +$ctx1.sendIdx["new"]=1; +$1=$recv($2)._ifEmpty_((function(){ +return (42); + +})); +$ctx1.sendIdx["ifEmpty:"]=1; +self._assert_equals_($1,(42)); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["removeFrom:to:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,[(1), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$5=self._collection(); +$ctx1.sendIdx["collection"]=1; +$4=$recv($5)._ifEmpty_((function(){ +return (42); + +})); +$6=self._collection(); +$ctx1.sendIdx["collection"]=2; +self._assert_equals_($4,$6); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]); +$9=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=2; +$8=$recv($9)._new(); +$ctx1.sendIdx["new"]=2; +$7=$recv($8)._ifNotEmpty_((function(){ +return (42); + +})); +$ctx1.sendIdx["ifNotEmpty:"]=1; +$11=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=3; +$10=$recv($11)._new(); +$ctx1.sendIdx["new"]=3; +self._assert_equals_($7,$10); +$ctx1.sendIdx["assert:equals:"]=3; +$13=self._collection(); +$ctx1.sendIdx["collection"]=3; +$12=$recv($13)._ifNotEmpty_((function(){ +return (42); + +})); +$ctx1.sendIdx["ifNotEmpty:"]=2; +self._assert_equals_($12,(42)); +$ctx1.sendIdx["assert:equals:"]=4; +$15=self._collection(); +$ctx1.sendIdx["collection"]=4; +$14=$recv($15)._ifNotEmpty_((function(col){ +return col; + +})); +$16=self._collection(); +$ctx1.sendIdx["collection"]=5; +self._assert_equals_($14,$16); +$ctx1.sendIdx["assert:equals:"]=5; +$19=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=4; +$18=$recv($19)._new(); +$ctx1.sendIdx["new"]=4; +$17=$recv($18)._ifEmpty_ifNotEmpty_((function(){ +return (42); + +}),(function(){ +return (999); + +})); +$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1; +self._assert_equals_($17,(42)); +$ctx1.sendIdx["assert:equals:"]=6; +$21=self._collection(); +$ctx1.sendIdx["collection"]=6; +$20=$recv($21)._ifEmpty_ifNotEmpty_((function(){ +return (42); + +}),(function(){ +return (999); + +})); +$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2; +self._assert_equals_($20,(999)); +$ctx1.sendIdx["assert:equals:"]=7; +$23=self._collection(); +$ctx1.sendIdx["collection"]=7; +$22=$recv($23)._ifEmpty_ifNotEmpty_((function(){ +return (42); + +}),(function(col){ +return col; + +})); +$24=self._collection(); +$ctx1.sendIdx["collection"]=8; +self._assert_equals_($22,$24); +$ctx1.sendIdx["assert:equals:"]=8; +$25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){ +return (42); + +}),(function(){ +return (999); + +})); +$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1; +self._assert_equals_($25,(999)); +$ctx1.sendIdx["assert:equals:"]=9; +$27=self._collection(); +$ctx1.sendIdx["collection"]=9; +$26=$recv($27)._ifNotEmpty_ifEmpty_((function(){ +return (42); + +}),(function(){ +return (999); + +})); +$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2; +self._assert_equals_($26,(42)); +$ctx1.sendIdx["assert:equals:"]=10; +$29=self._collection(); +$ctx1.sendIdx["collection"]=10; +$28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){ +return col; + +}),(function(){ +return (999); + +})); +self._assert_equals_($28,self._collection()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)}); +}, +args: [], +source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.", +referencedClasses: [], +messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"] +}), +$globals.CollectionTest); + +$core.addMethod( +$core.method({ +selector: "testIsEmpty", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $1; +$1=$recv($recv(self._collectionClass())._new())._isEmpty(); +$ctx1.sendIdx["isEmpty"]=1; +self._assert_($1); +self._deny_($recv(self._collection())._isEmpty()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)", +source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "removeFrom:to:"] +messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testRemoveIndex", +selector: "testNoneSatisfy", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var anyOne; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=[(1), (2), (3), (4)]._removeIndex_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["removeIndex:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,[(1), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=[(1), (2), (3), (4)]._removeIndex_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["removeIndex:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,[(2), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_(["hello"]._removeIndex_((1)),[]); +var $1,$3,$2; +$1=self._collection(); +$ctx1.sendIdx["collection"]=1; +anyOne=$recv($1)._anyOne(); +$3=self._collection(); +$ctx1.sendIdx["collection"]=2; +$2=$recv($3)._noneSatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__eq(anyOne); +$ctx2.sendIdx["="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$ctx1.sendIdx["noneSatisfy:"]=1; +self._deny_($2); +self._assert_($recv(self._collection())._noneSatisfy_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__eq($recv($Object())._new()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); +}))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "removeIndex:"] +source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])", +referencedClasses: ["Object"], +messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testRemoveLast", +selector: "testRemoveAll", protocol: 'tests', fn: function (){ var self=this; -var array; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=[(1), (2)]; -$recv(array)._removeLast(); -self._assert_equals_($recv(array)._last(),(1)); +var $1,$2; +$1=self._collection(); +$recv($1)._removeAll(); +$2=$recv($1)._yourself(); +self._assert_equals_($2,$recv(self._collectionClass())._new()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1", +source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["removeLast", "assert:equals:", "last"] +messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testReversed", +selector: "testSelect", protocol: 'tests', fn: function (){ var self=this; -var array; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=[(5), (4), (3), (2), (1)]; -self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]); +var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._select_((function(){ +return false; + +})); +$ctx1.sendIdx["select:"]=1; +$4=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$3=$recv($4)._new(); +$ctx1.sendIdx["new"]=1; +self._assert_equals_($1,$3); +$ctx1.sendIdx["assert:equals:"]=1; +$6=self._collection(); +$ctx1.sendIdx["collection"]=2; +$5=$recv($6)._select_((function(){ +return true; + +})); +$ctx1.sendIdx["select:"]=2; +$7=self._collection(); +$ctx1.sendIdx["collection"]=3; +self._assert_equals_($5,$7); +$ctx1.sendIdx["assert:equals:"]=2; +$9=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$8=$recv($9)._select_((function(each){ +return $core.withContext(function($ctx2) { +$10=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=1; +return $recv(each).__eq($10); +$ctx2.sendIdx["="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); +})); +$ctx1.sendIdx["select:"]=3; +self._assert_equals_($8,self._sampleNewValueAsCollection()); +$ctx1.sendIdx["assert:equals:"]=3; +$12=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=2; +$11=$recv($12)._select_((function(each){ +return $core.withContext(function($ctx2) { +$13=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +return $recv(each).__tild_eq($13); +$ctx2.sendIdx["~="]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)}); +})); +$ctx1.sendIdx["select:"]=4; +$14=self._collection(); +$ctx1.sendIdx["collection"]=4; +self._assert_equals_($11,$14); +$ctx1.sendIdx["assert:equals:"]=4; +$16=self._collection(); +$ctx1.sendIdx["collection"]=5; +$15=$recv($16)._select_((function(each){ +return $core.withContext(function($ctx2) { +$17=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=3; +return $recv(each).__eq($17); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)}); +})); +$ctx1.sendIdx["select:"]=5; +self._assert_equals_($15,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=5; +self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(each).__tild_eq(self._sampleNewValue()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)}); +})),self._collection()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)", +source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "reversed"] +messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( $core.method({ -selector: "testSort", +selector: "testSize", protocol: 'tests', fn: function (){ var self=this; -var array; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -array=[(10), (1), (5)]; -$recv(array)._sort(); -self._assert_equals_(array,[(1), (5), (10)]); +var $1,$2; +$1=$recv($recv(self._collectionClass())._new())._size(); +$ctx1.sendIdx["size"]=1; +self._assert_equals_($1,(0)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=$recv(self._sampleNewValueAsCollection())._size(); +$ctx1.sendIdx["size"]=2; +self._assert_equals_($2,(1)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(self._collection())._size(),self._collectionSize()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)", +source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["sort", "assert:equals:"] +messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"] }), -$globals.ArrayTest); +$globals.CollectionTest); $core.addMethod( @@ -70792,10531 +54419,7497 @@ selector: "collectionClass", protocol: 'fixture', fn: function (){ var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -return $Array(); +return nil; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ Array", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); +source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil", +referencedClasses: [], messageSends: [] }), -$globals.ArrayTest.klass); - +$globals.CollectionTest.klass); -$core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collection", -protocol: 'fixture', +selector: "isAbstract", +protocol: 'testing', fn: function (){ var self=this; -return "helLo"; - +return $core.withContext(function($ctx1) { +var $1; +$1=$recv(self._collectionClass())._isNil(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09^ 'helLo'", +source: "isAbstract\x0a\x09^ self collectionClass isNil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["isNil", "collectionClass"] }), -$globals.StringTest); +$globals.CollectionTest.klass); + +$core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionFirst", +selector: "collectionWithNewValue", protocol: 'fixture', fn: function (){ var self=this; -return "h"; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirst\x0a\x09^ 'h'", +source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionFirstTwo", +selector: "sampleNewIndex", protocol: 'fixture', fn: function (){ var self=this; -return "he"; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionFirstTwo\x0a\x09^ 'he'", +source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionLast", +selector: "sampleNonIndexesDo:", protocol: 'fixture', -fn: function (){ +fn: function (aBlock){ var self=this; -return "o"; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionLast\x0a\x09^ 'o'", +args: ["aBlock"], +source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionLastTwo", +selector: "samplesDo:", protocol: 'fixture', -fn: function (){ +fn: function (aBlock){ var self=this; -return "Lo"; - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionLastTwo\x0a\x09^ 'Lo'", +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testAt", +protocol: 'tests', fn: function (){ var self=this; -return "'h''e''l''L''o'"; - +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $core.withContext(function($ctx1) { +var $1; +self._nonIndexesDo_((function(each){ +return $core.withContext(function($ctx2) { +return self._should_raise_((function(){ +return $core.withContext(function($ctx3) { +$1=self._collection(); +$ctx3.sendIdx["collection"]=1; +return $recv($1)._at_(each); +$ctx3.sendIdx["at:"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}),$Error()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +return self._assert_equals_($recv(self._collection())._at_(index),value); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]", +referencedClasses: ["Error"], +messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionSize", -protocol: 'fixture', +selector: "testAtIfAbsent", +protocol: 'tests', fn: function (){ var self=this; -return (5); - +return $core.withContext(function($ctx1) { +var $2,$1,$3; +self._nonIndexesDo_((function(each){ +return $core.withContext(function($ctx2) { +$2=self._collection(); +$ctx2.sendIdx["collection"]=1; +$1=$recv($2)._at_ifAbsent_(each,(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +$ctx3.sendIdx["sampleNewValue"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +$ctx2.sendIdx["at:ifAbsent:"]=1; +$3=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +return self._assert_equals_($1,$3); +$ctx2.sendIdx["assert:equals:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)}); +})),value); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09^ 5", +source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", -protocol: 'fixture', +selector: "testAtIfAbsentPut", +protocol: 'tests', fn: function (){ var self=this; -return "abbaerte"; - +var newCollection; +return $core.withContext(function($ctx1) { +var $1; +newCollection=self._collection(); +$ctx1.sendIdx["collection"]=1; +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +$1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +$ctx3.sendIdx["sampleNewValue"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +$ctx2.sendIdx["at:ifAbsentPut:"]=1; +return self._assert_equals_($1,value); +$ctx2.sendIdx["assert:equals:"]=1; +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); +})); +self._assert_equals_(newCollection,self._collection()); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){ +return $core.withContext(function($ctx2) { +return self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +})),self._sampleNewValue()); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_(newCollection,self._collectionWithNewValue()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'", +source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "collectionWithNewValue", -protocol: 'fixture', +selector: "testAtIfPresent", +protocol: 'tests', fn: function (){ var self=this; -return "helLoN"; +var visited,sentinel; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +return $core.withContext(function($ctx1) { +var $2,$1,$4,$3; +sentinel=$recv($Object())._new(); +self._nonIndexesDo_((function(each){ +return $core.withContext(function($ctx2) { +visited=nil; +visited; +$2=self._collection(); +$ctx2.sendIdx["collection"]=1; +$1=$recv($2)._at_ifPresent_(each,(function(value1){ +visited=value1; +visited; +return sentinel; + +})); +$ctx2.sendIdx["at:ifPresent:"]=1; +self._assert_equals_($1,nil); +$ctx2.sendIdx["assert:equals:"]=1; +return self._assert_($recv(visited)._isNil()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +visited=nil; +visited; +$4=self._collection(); +$ctx2.sendIdx["collection"]=2; +$3=$recv($4)._at_ifPresent_(index,(function(value2){ +visited=value2; +visited; +return sentinel; +})); +self._assert_equals_($3,sentinel); +$ctx2.sendIdx["assert:equals:"]=2; +return self._assert_equals_(visited,$recv(self._collection())._at_(index)); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithNewValue\x0a\x09^ 'helLoN'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]", +referencedClasses: ["Object"], +messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "sampleNewValueAsCollection", -protocol: 'fixture', +selector: "testAtIfPresentIfAbsent", +protocol: 'tests', fn: function (){ var self=this; -return "N"; +var visited,sentinel; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +return $core.withContext(function($ctx1) { +var $2,$1,$3,$5,$4; +sentinel=$recv($Object())._new(); +self._nonIndexesDo_((function(each){ +return $core.withContext(function($ctx2) { +visited=nil; +visited; +$2=self._collection(); +$ctx2.sendIdx["collection"]=1; +$1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){ +visited=value1; +visited; +return sentinel; + +}),(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +$ctx3.sendIdx["sampleNewValue"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); +})); +$ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1; +$3=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +self._assert_equals_($1,$3); +$ctx2.sendIdx["assert:equals:"]=1; +return self._assert_($recv(visited)._isNil()); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +visited=nil; +visited; +$5=self._collection(); +$ctx2.sendIdx["collection"]=2; +$4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){ +visited=value2; +visited; +return sentinel; +}),(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)}); +})); +self._assert_equals_($4,sentinel); +$ctx2.sendIdx["assert:equals:"]=2; +return self._assert_equals_(visited,$recv(self._collection())._at_(index)); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "sampleNewValueAsCollection\x0a\x09^ 'N'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]", +referencedClasses: ["Object"], +messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "samplesDo:", -protocol: 'fixture', -fn: function (aBlock){ +selector: "testAtPut", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var newCollection; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$recv(aBlock)._value_value_((3),"l"); +newCollection=self._collection(); +$ctx1.sendIdx["collection"]=1; +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +return $recv(newCollection)._at_put_(index,value); +$ctx2.sendIdx["at:put:"]=1; +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); +})); +self._assert_equals_(newCollection,self._collection()); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue()); +self._assert_equals_(newCollection,self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aBlock"], -source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'", +args: [], +source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["samplesDo:", "value:value:"] +messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "testAddAll", +selector: "testEquality", protocol: 'tests', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -return $recv($1)._addAll_(self._collection()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8; +$2=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$1=$recv($2)._new(); +$ctx1.sendIdx["new"]=1; +$4=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=2; +$3=$recv($4)._new(); +$ctx1.sendIdx["new"]=2; +self._assert_equals_($1,$3); +$ctx1.sendIdx["assert:equals:"]=1; +$5=self._collection(); +$ctx1.sendIdx["collection"]=1; +$6=self._collection(); +$ctx1.sendIdx["collection"]=2; +self._assert_equals_($5,$6); +$ctx1.sendIdx["assert:equals:"]=2; +$7=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +self._assert_equals_($7,self._collectionWithNewValue()); +$10=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=3; +$9=$recv($10)._new(); +$ctx1.sendIdx["new"]=3; +$11=self._collection(); +$ctx1.sendIdx["collection"]=3; +$8=$recv($9).__eq($11); +$ctx1.sendIdx["="]=1; +self._deny_($8); +$ctx1.sendIdx["deny:"]=1; +self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "addAll:", "collection"] +source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new", +referencedClasses: [], +messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "testAddRemove", +selector: "testIndexOf", protocol: 'tests', fn: function (){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); +var $1; self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello"._add_("a"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1=self._collection(); +$ctx2.sendIdx["collection"]=1; +return $recv($1)._indexOf_(self._sampleNewValue()); +$ctx2.sendIdx["indexOf:"]=1; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=1; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._samplesDo_((function(index,value){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello"._remove_("h"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$Error()); +return self._assert_equals_($recv(self._collection())._indexOf_(value),index); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error", +source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]", referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "add:", "remove:"] +messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "testAsArray", +selector: "testIndexOfWithNull", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsNull; +function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]); +var $1,$2; +jsNull=$recv($JSON())._parse_("null"); +self._samplesDo_((function(index,value){ +return $core.withContext(function($ctx2) { +$1=self._collection(); +$recv($1)._at_put_(index,jsNull); +$2=$recv($1)._indexOf_(jsNull); +return self._assert_equals_($2,index); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asArray"] +source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]", +referencedClasses: ["JSON"], +messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); $core.addMethod( $core.method({ -selector: "testAsLowerCase", +selector: "testWithIndexDo", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var collection; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("JACKIE"._asLowercase(),"jackie"); +collection=self._collection(); +$ctx1.sendIdx["collection"]=1; +$recv(self._collection())._withIndexDo_((function(each,index){ +return $core.withContext(function($ctx2) { +return self._assert_equals_($recv(collection)._at_(index),each); +}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.", +source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asLowercase"] +messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"] }), -$globals.StringTest); +$globals.IndexableCollectionTest); + + +$core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAsNumber", -protocol: 'tests', +selector: "collectionKeys", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1="3"._asNumber(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asNumber"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2="-3"._asNumber(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asNumber"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(-3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_("-1.5"._asNumber(),(-1.5)); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.", +source: "collectionKeys\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asNumber"] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testAsUpperCase", -protocol: 'tests', +selector: "collectionValues", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("jackie"._asUppercase(),"JACKIE"); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.", +source: "collectionValues\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asUppercase"] +messageSends: ["subclassResponsibility"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testAsciiValue", -protocol: 'tests', -fn: function (){ +selector: "nonIndexesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -var characterA,characterU; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -characterA="A"; -characterU="U"; -$1=$recv(characterA)._asciiValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asciiValue"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(65)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(characterU)._asciiValue(),(85)); +$recv(aBlock)._value_((5)); +$ctx1.sendIdx["value:"]=1; +$recv(aBlock)._value_("z"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85", +args: ["aBlock"], +source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asciiValue"] +messageSends: ["value:"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testAtIfAbsentPut", -protocol: 'tests', +selector: "sampleNewIndex", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello"._at_ifAbsentPut_((6),(function(){ -return "a"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "at:ifAbsentPut:"] -}), -$globals.StringTest); +return "new"; -$core.addMethod( -$core.method({ -selector: "testAtPut", -protocol: 'tests', -fn: function (){ -var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello"._at_put_((1),"a"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "at:put:"] +source: "sampleNewIndex\x0a\x09^ 'new'", +referencedClasses: [], +messageSends: [] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testCapitalized", -protocol: 'tests', -fn: function (){ +selector: "samplesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -$1="test"._capitalized(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["capitalized"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"Test"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2="Test"._capitalized(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["capitalized"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,"Test"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_(""._capitalized(),""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$3="Test"._isCapitalized(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isCapitalized"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($3,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_("test"._isCapitalized(),false); +$recv(aBlock)._value_value_("a",(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.", +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "capitalized", "isCapitalized"] +messageSends: ["value:value:"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testCharCodeAt", +selector: "testAddAll", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5; -$1="jackie"._charCodeAt_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["charCodeAt:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(106)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13; +( +$ctx1.supercall = true, +$globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), [])); +$ctx1.supercall = false; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$3=$2; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$recv($3)._addAll_($4); +$ctx1.sendIdx["addAll:"]=1; +$5=$recv($2)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$1=$5; +$6=self._collection(); +$ctx1.sendIdx["collection"]=3; +self._assert_equals_($1,$6); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2="jackie"._charCodeAt_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["charCodeAt:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(97)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$8=self._collection(); +$ctx1.sendIdx["collection"]=4; +$9=$8; +$10=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$recv($9)._addAll_($10); +$ctx1.sendIdx["addAll:"]=2; +$11=$recv($8)._yourself(); +$ctx1.sendIdx["yourself"]=2; +$7=$11; +$12=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=2; +self._assert_equals_($7,$12); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$3="jackie"._charCodeAt_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["charCodeAt:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(99)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$4="jackie"._charCodeAt_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["charCodeAt:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($4,(107)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$5="jackie"._charCodeAt_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["charCodeAt:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($5,(105)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_("jackie"._charCodeAt_((6)),(101)); +$14=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=3; +$recv($14)._addAll_(self._collection()); +$15=$recv($14)._yourself(); +$13=$15; +self._assert_equals_($13,self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101", +source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "charCodeAt:"] +messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testCopyFromTo", +selector: "testAsDictionary", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1="jackie"._copyFrom_to_((1),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["copyFrom:to:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"jac"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie"); +self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "copyFrom:to:"] +source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).", +referencedClasses: ["Dictionary"], +messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testCopyWithoutAll", +selector: "testAsHashedCollection", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world"); +self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "copyWithoutAll:"] +source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).", +referencedClasses: ["HashedCollection"], +messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testEquality", +selector: "testComma", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -self._assert_equals_("hello","hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9; +( +$ctx1.supercall = true, +$globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), [])); +$ctx1.supercall = false; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$3=self._collection(); +$ctx1.sendIdx["collection"]=2; +$1=$recv($2).__comma($3); +$ctx1.sendIdx[","]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=3; +self._assert_equals_($1,$4); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$1="hello".__eq("world"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$2="hello".__eq([]._at_ifAbsent_((1),(function(){ - -}))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$3="hello"._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_("hello",$3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$6=self._collection(); +$ctx1.sendIdx["collection"]=4; +$7=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$5=$recv($6).__comma($7); +$ctx1.sendIdx[","]=2; +$8=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=2; +self._assert_equals_($5,$8); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_("hello"._yourself(),"hello"); -self._deny_("".__eq((0))); +$10=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=3; +$9=$recv($10).__comma(self._collection()); +self._assert_equals_($9,self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0", +source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"] +messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIdentity", +selector: "testFrom", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var associations; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$5; -$1="hello".__eq_eq("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2="hello".__eq_eq("world"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$4="hello"._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$3="hello".__eq_eq($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=3; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$5=$recv("hello"._yourself()).__eq_eq("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=4; -//>>excludeEnd("ctx"); -self._assert_($5); -self._deny_("".__eq_eq((0))); +var $1; +$1="a".__minus_gt((1)); +$ctx1.sendIdx["->"]=1; +associations=[$1,"b".__minus_gt((2))]; +self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0", +source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "==", "deny:", "yourself"] +messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIdentityHash", +selector: "testKeys", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3; -$1="foo"._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=1; -//>>excludeEnd("ctx"); -$2="foo"._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$2); -$4="foo"._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=3; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq("bar"._identityHash()); -self._deny_($3); +var $2,$1,$3,$4; +$2=$recv($recv(self._collectionClass())._new())._keys(); +$ctx1.sendIdx["keys"]=1; +$1=$recv($2)._isEmpty(); +self._assert_($1); +$3=$recv(self._collection())._keys(); +$ctx1.sendIdx["keys"]=2; +$4=self._collectionKeys(); +$ctx1.sendIdx["collectionKeys"]=1; +self._assertSameContents_as_($3,$4); +$ctx1.sendIdx["assertSameContents:as:"]=1; +self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)", +source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "identityHash", "deny:", "="] +messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIncludesSubString", +selector: "testNewFromPairs", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var flattenedAssociations; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1="amber"._includesSubString_("ber"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includesSubString:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -self._deny_("amber"._includesSubString_("zork")); +flattenedAssociations=["a",(1),"b",(2)]; +self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').", +source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "includesSubString:", "deny:"] +messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIndexOfStartingAtWithNull", +selector: "testPrintString", protocol: 'tests', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { +var $3,$2,$4,$1,$5; +$3=self._collectionClass(); +$ctx1.sendIdx["collectionClass"]=1; +$2=$recv($3)._new(); +$recv($2)._at_put_("firstname","James"); +$ctx1.sendIdx["at:put:"]=1; +$recv($2)._at_put_("lastname","Bond"); +$4=$recv($2)._printString(); +$1=$4; +$5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')"); +$ctx1.sendIdx[","]=1; +self._assert_equals_($1,$5); return self; - +}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22", +source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIndexOfWithNull", +selector: "testRemoveKey", protocol: 'tests', fn: function (){ var self=this; +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$6,$4,$7,$8; +self._nonIndexesDo_((function(each){ +var collection; +return $core.withContext(function($ctx2) { +collection=self._collection(); +$ctx2.sendIdx["collection"]=1; +collection; +self._should_raise_((function(){ +return $core.withContext(function($ctx3) { +return $recv(collection)._removeKey_(each); +$ctx3.sendIdx["removeKey:"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +}),$Error()); +$1=collection; +$2=self._collection(); +$ctx2.sendIdx["collection"]=2; +return self._assert_equals_($1,$2); +$ctx2.sendIdx["assert:equals:"]=1; +}, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +var collection; +return $core.withContext(function($ctx2) { +collection=self._collection(); +$ctx2.sendIdx["collection"]=3; +collection; +$3=$recv(collection)._removeKey_(index); +$ctx2.sendIdx["removeKey:"]=2; +self._assert_equals_($3,value); +$ctx2.sendIdx["assert:equals:"]=2; +$5=collection; +$6=self._collection(); +$ctx2.sendIdx["collection"]=4; +$4=$recv($5).__eq($6); +return self._deny_($4); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)}); +})); +$7=self._collectionWithNewValue(); +$recv($7)._removeKey_(self._sampleNewIndex()); +$8=$recv($7)._yourself(); +self._assert_equals_($8,self._collection()); return self; - +}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection", +referencedClasses: ["Error"], +messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testIsVowel", +selector: "testRemoveKeyIfAbsent", protocol: 'tests', fn: function (){ var self=this; -var vowel,consonant; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -vowel="u"; -consonant="z"; -$1=$recv(vowel)._isVowel(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isVowel"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(consonant)._isVowel(),false); +var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10; +self._nonIndexesDo_((function(each){ +var collection; +return $core.withContext(function($ctx2) { +collection=self._collection(); +$ctx2.sendIdx["collection"]=1; +collection; +$1=$recv(collection)._removeKey_ifAbsent_(each,(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +$ctx3.sendIdx["sampleNewValue"]=1; +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); +})); +$ctx2.sendIdx["removeKey:ifAbsent:"]=1; +$2=self._sampleNewValue(); +$ctx2.sendIdx["sampleNewValue"]=2; +self._assert_equals_($1,$2); +$ctx2.sendIdx["assert:equals:"]=1; +$3=collection; +$4=self._collection(); +$ctx2.sendIdx["collection"]=2; +return self._assert_equals_($3,$4); +$ctx2.sendIdx["assert:equals:"]=2; +}, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)}); +})); +self._samplesDo_((function(index,value){ +var collection; +return $core.withContext(function($ctx2) { +collection=self._collection(); +$ctx2.sendIdx["collection"]=3; +collection; +$5=$recv(collection)._removeKey_ifAbsent_(index,(function(){ +return $core.withContext(function($ctx3) { +return self._sampleNewValue(); +}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)}); +})); +$ctx2.sendIdx["removeKey:ifAbsent:"]=2; +self._assert_equals_($5,value); +$ctx2.sendIdx["assert:equals:"]=3; +$7=collection; +$8=self._collection(); +$ctx2.sendIdx["collection"]=4; +$6=$recv($7).__eq($8); +return self._deny_($6); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)}); +})); +$9=self._collectionWithNewValue(); +$recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){ +return $core.withContext(function($ctx2) { +return self._assert_(false); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); +})); +$10=$recv($9)._yourself(); +self._assert_equals_($10,self._collection()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false", +source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "isVowel"] +messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); $core.addMethod( $core.method({ -selector: "testJoin", +selector: "testValues", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(","._join_(["hello", "world"]),"hello,world"); +var $2,$1,$3,$4; +$2=$recv($recv(self._collectionClass())._new())._values(); +$ctx1.sendIdx["values"]=1; +$1=$recv($2)._isEmpty(); +self._assert_($1); +$3=$recv(self._collection())._values(); +$ctx1.sendIdx["values"]=2; +$4=self._collectionValues(); +$ctx1.sendIdx["collectionValues"]=1; +self._assertSameContents_as_($3,$4); +$ctx1.sendIdx["assertSameContents:as:"]=1; +self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'", +source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "join:"] +messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"] }), -$globals.StringTest); +$globals.AssociativeCollectionTest); + + +$core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testRemoveAll", -protocol: 'tests', +selector: "collection", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._collection())._removeAll(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($Dictionary())._new(); +$recv($2)._at_put_((1),(1)); +$ctx1.sendIdx["at:put:"]=1; +$recv($2)._at_put_("a",(2)); +$ctx1.sendIdx["at:put:"]=2; +$recv($2)._at_put_(true,(3)); +$ctx1.sendIdx["at:put:"]=3; +$recv($2)._at_put_((1).__at((3)),(-4)); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "removeAll", "collection"] +source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself", +referencedClasses: ["Dictionary"], +messageSends: ["at:put:", "new", "@", "yourself"] }), -$globals.StringTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "testReversed", -protocol: 'tests', +selector: "collectionKeys", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("jackiechan"._reversed(),"nahceikcaj"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1),"a",true,(1).__at((3))]; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.", +source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "reversed"] +messageSends: ["@"] }), -$globals.StringTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "testStreamContents", -protocol: 'tests', +selector: "collectionOfPrintStrings", +protocol: 'fixture', fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self._assert_equals_($recv($String())._streamContents_((function(aStream){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$recv(aStream)._nextPutAll_("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["nextPutAll:"]=1; -//>>excludeEnd("ctx"); -$recv(aStream)._space(); -$1=$recv(aStream)._nextPutAll_("world"); +var $2,$3,$1; +$2=$recv($Dictionary())._new(); +$recv($2)._at_put_((1),"1"); +$ctx1.sendIdx["at:put:"]=1; +$recv($2)._at_put_("a","2"); +$ctx1.sendIdx["at:put:"]=2; +$recv($2)._at_put_(true,"3"); +$ctx1.sendIdx["at:put:"]=3; +$recv($2)._at_put_((1).__at((3)),"-4"); +$3=$recv($2)._yourself(); +$1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)}); -//>>excludeEnd("ctx"); -})),"hello world"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"] +source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself", +referencedClasses: ["Dictionary"], +messageSends: ["at:put:", "new", "@", "yourself"] }), -$globals.StringTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "testSubStrings", -protocol: 'tests', +selector: "collectionSize", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +return (4); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).", +source: "collectionSize\x0a\x09^ 4", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "subStrings:"] +messageSends: [] }), -$globals.StringTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "testTrim", -protocol: 'tests', +selector: "collectionValues", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(" jackie"._trimLeft(),"jackie"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_("jackie "._trimRight(),"jackie"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1),(2),(3),(-4)]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.", +source: "collectionValues\x0a\x09^ {1. 2. 3. -4}", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "trimLeft", "trimRight"] +messageSends: [] }), -$globals.StringTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "testValue", -protocol: 'tests', +selector: "collectionWithDuplicates", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_("asString"._value_((1)),"1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($Dictionary())._new(); +$recv($2)._at_put_((1),(1)); +$ctx1.sendIdx["at:put:"]=1; +$recv($2)._at_put_("a",(2)); +$ctx1.sendIdx["at:put:"]=2; +$recv($2)._at_put_(true,(3)); +$ctx1.sendIdx["at:put:"]=3; +$recv($2)._at_put_((4),(-4)); +$ctx1.sendIdx["at:put:"]=4; +$recv($2)._at_put_("b",(1)); +$ctx1.sendIdx["at:put:"]=5; +$recv($2)._at_put_((3),(3)); +$ctx1.sendIdx["at:put:"]=6; +$recv($2)._at_put_(false,(12)); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "value:", "collect:"] +source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself", +referencedClasses: ["Dictionary"], +messageSends: ["at:put:", "new", "yourself"] }), -$globals.StringTest); - +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "collectionClass", +selector: "collectionWithNewValue", protocol: 'fixture', fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -return $String(); - +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($Dictionary())._new(); +$recv($2)._at_put_((1),(1)); +$ctx1.sendIdx["at:put:"]=1; +$recv($2)._at_put_("a",(2)); +$ctx1.sendIdx["at:put:"]=2; +$recv($2)._at_put_(true,(3)); +$ctx1.sendIdx["at:put:"]=3; +$recv($2)._at_put_((1).__at((3)),(-4)); +$ctx1.sendIdx["at:put:"]=4; +$recv($2)._at_put_("new","N"); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ String", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: [] +source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself", +referencedClasses: ["Dictionary"], +messageSends: ["at:put:", "new", "@", "yourself"] }), -$globals.StringTest.klass); - +$globals.DictionaryTest); -$core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collection", +selector: "sampleNewValueAsCollection", protocol: 'fixture', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1; -$2=$recv($Set())._new(); -$recv($2)._add_($Smalltalk()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._add_(nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._add_((3).__at((3))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._add_(false); +$2=$recv($Dictionary())._new(); +$recv($2)._at_put_("new","N"); $3=$recv($2)._yourself(); $1=$3; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)}); +}, +args: [], +source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself", +referencedClasses: ["Dictionary"], +messageSends: ["at:put:", "new", "yourself"] +}), +$globals.DictionaryTest); + +$core.addMethod( +$core.method({ +selector: "samplesDo:", +protocol: 'fixture', +fn: function (aBlock){ +var self=this; +return $core.withContext(function($ctx1) { +( +$ctx1.supercall = true, +$globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); +$ctx1.supercall = false; +$recv(aBlock)._value_value_(true,(3)); +$ctx1.sendIdx["value:value:"]=1; +$recv(aBlock)._value_value_((1).__at((3)),(-4)); +return self; +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)}); +}, +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4", +referencedClasses: [], +messageSends: ["samplesDo:", "value:value:", "@"] +}), +$globals.DictionaryTest); + +$core.addMethod( +$core.method({ +selector: "testAccessing", +protocol: 'tests', +fn: function (){ +var self=this; +var d; +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11; +d=$recv($Dictionary())._new(); +$recv(d)._at_put_("hello","world"); +$ctx1.sendIdx["at:put:"]=1; +$1=$recv(d)._at_("hello"); +$ctx1.sendIdx["at:"]=1; +self._assert_equals_($1,"world"); +$ctx1.sendIdx["assert:equals:"]=1; +$2=$recv(d)._at_ifAbsent_("hello",(function(){ +return nil; + +})); +$ctx1.sendIdx["at:ifAbsent:"]=1; +self._assert_equals_($2,"world"); +$ctx1.sendIdx["assert:equals:"]=2; +self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){ +return nil; + +}))).__eq("world")); +$ctx1.sendIdx["deny:"]=1; +$3=$recv(d)._includesKey_("hello"); +$ctx1.sendIdx["includesKey:"]=1; +self._assert_($3); +$ctx1.sendIdx["assert:"]=1; +$4=$recv(d)._includesKey_("foo"); +$ctx1.sendIdx["includesKey:"]=2; +self._deny_($4); +$ctx1.sendIdx["deny:"]=2; +$recv(d)._at_put_((1),(2)); +$ctx1.sendIdx["at:put:"]=2; +$5=$recv(d)._at_((1)); +$ctx1.sendIdx["at:"]=2; +self._assert_equals_($5,(2)); +$ctx1.sendIdx["assert:equals:"]=3; +$6=d; +$7=(1).__at((3)); +$ctx1.sendIdx["@"]=1; +$recv($6)._at_put_($7,(3)); +$9=d; +$10=(1).__at((3)); +$ctx1.sendIdx["@"]=2; +$8=$recv($9)._at_($10); +self._assert_equals_($8,(3)); +$12=d; +$13=(1).__at((3)); +$ctx1.sendIdx["@"]=3; +$11=$recv($12)._includesKey_($13); +$ctx1.sendIdx["includesKey:"]=3; +self._assert_($11); +self._deny_($recv(d)._includesKey_((3).__at((1)))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself", -referencedClasses: ["Set", "Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["add:", "new", "@", "yourself"] +source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)", +referencedClasses: ["Dictionary"], +messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"] }), -$globals.SetTest); +$globals.DictionaryTest); $core.addMethod( $core.method({ -selector: "collectionOfPrintStrings", -protocol: 'fixture', +selector: "testDynamicDictionaries", +protocol: 'tests', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Set())._new(); -$recv($2)._add_("a SmalltalkImage"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._add_("nil"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._add_("3@3"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._add_("false"); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1)))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["add:", "new", "yourself"] +source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)", +referencedClasses: ["Dictionary"], +messageSends: ["assert:equals:", "asDictionary", "with:", "->"] }), -$globals.SetTest); +$globals.DictionaryTest); + $core.addMethod( $core.method({ -selector: "collectionSize", +selector: "collectionClass", protocol: 'fixture', fn: function (){ var self=this; -return (4); +function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} +return $Dictionary(); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionSize\x0a\x09^ 4", -referencedClasses: [], -//>>excludeEnd("ide"); +source: "collectionClass\x0a\x09^ Dictionary", +referencedClasses: ["Dictionary"], messageSends: [] }), -$globals.SetTest); +$globals.DictionaryTest.klass); + +$core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionWithDuplicates", +selector: "collection", protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=self._collection(); -$recv($2)._add_((0)); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself", +source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["add:", "collection", "yourself"] +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "collectionWithNewValue", +selector: "collectionKeys", protocol: 'fixture', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Set())._new(); -$recv($2)._add_($Smalltalk()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv($2)._add_(nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv($2)._add_((3).__at((3))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$recv($2)._add_("N"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=4; -//>>excludeEnd("ctx"); -$recv($2)._add_(false); -$3=$recv($2)._yourself(); -$1=$3; +var $1; +$1=["b","a","c","d"]; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself", -referencedClasses: ["Set", "Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["add:", "new", "@", "yourself"] -}), -$globals.SetTest); -$core.addMethod( -$core.method({ -selector: "testAddAll", -protocol: 'tests', -fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$3=$2; -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$recv($3)._addAll_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=1; -//>>excludeEnd("ctx"); -$5=$recv($2)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$1=$5; -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$8=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$9=$8; -$10=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$recv($9)._addAll_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["addAll:"]=2; -//>>excludeEnd("ctx"); -$11=$recv($8)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$7=$11; -$12=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($7,$12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$14=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=3; -//>>excludeEnd("ctx"); -$recv($14)._addAll_(self._collection()); -$15=$recv($14)._yourself(); -$13=$15; -self._assert_equals_($13,self._collectionWithNewValue()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue", +source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"] +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testAddRemove", -protocol: 'tests', +selector: "collectionOfPrintStrings", +protocol: 'fixture', fn: function (){ var self=this; -var set; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -set=$recv($Set())._new(); -self._assert_($recv(set)._isEmpty()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$recv(set)._add_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$1=$recv(set)._includes_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includes:"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$recv(set)._add_((5)); -$2=$recv(set)._includes_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["includes:"]=2; -//>>excludeEnd("ctx"); -self._assert_($2); -$recv(set)._remove_((3)); -self._deny_($recv(set)._includes_((3))); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]); +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"] +source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }", +referencedClasses: [], +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testAt", -protocol: 'tests', +selector: "collectionSize", +protocol: 'fixture', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv($Set())._new())._at_put_((1),(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +return (4); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error", -referencedClasses: ["Set", "Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "at:put:", "new"] +source: "collectionSize\x0a\x09^ 4", +referencedClasses: [], +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testCollect", -protocol: 'tests', +selector: "collectionValues", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=[(5), (6), (8)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._collect_((function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x).__backslash_backslash((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_($1,[(0), (2)]._asSet()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1),(2),(3),(-4)]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet", +source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"] +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testComma", -protocol: 'tests', +selector: "collectionWithDuplicates", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9; -( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = true, -//>>excludeEnd("ctx"); -$globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.supercall = false; -//>>excludeEnd("ctx");; -$2=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=1; -//>>excludeEnd("ctx"); -$3=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__comma($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); -$4=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=self._collection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collection"]=4; -//>>excludeEnd("ctx"); -$7=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6).__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); -$8=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$10=self._collectionWithNewValue(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["collectionWithNewValue"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10).__comma(self._collection()); -self._assert_equals_($9,self._collectionWithNewValue()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]); +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue", +source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"] +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testComparing", -protocol: 'tests', +selector: "collectionWithNewValue", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$6,$7,$5,$9,$8; -$1=[(0), (2)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=1; -//>>excludeEnd("ctx"); -$2=[(0), (2)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=[(2), (0)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=3; -//>>excludeEnd("ctx"); -$4=[(0), (2)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($3,$4); -$6=[(0), (2), (3)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=5; -//>>excludeEnd("ctx"); -$7=[(0), (2)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=6; -//>>excludeEnd("ctx"); -$5=$recv($6).__eq($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$9=[(1), (2)]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["asSet"]=7; -//>>excludeEnd("ctx"); -$8=$recv($9).__eq([(0), (2)]._asSet()); -self._deny_($8); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]); +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet", +source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asSet", "deny:", "="] +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testPrintString", -protocol: 'tests', +selector: "sampleNewValueAsCollection", +protocol: 'fixture', fn: function (){ var self=this; -var set; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5,$6,$7,$8,$9; -set=$recv($Set())._new(); -$1=$recv(set)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"a Set ()"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=set; -$recv($2)._add_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$3=$recv($2)._add_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$4=$recv(set)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,"a Set (1 3)"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$recv(set)._add_("foo"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$5=$recv(set)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"a Set (1 3 'foo')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$6=set; -$recv($6)._remove_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["remove:"]=1; -//>>excludeEnd("ctx"); -$7=$recv($6)._remove_((3)); -$8=$recv(set)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($8,"a Set ('foo')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$recv(set)._add_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=4; -//>>excludeEnd("ctx"); -$9=$recv(set)._printString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printString"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($9,"a Set (3 'foo')"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$recv(set)._add_((3)); -self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$globals.HashedCollection._newFromPairs_(["new","N"]); +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"] +source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }", +referencedClasses: [], +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest); $core.addMethod( $core.method({ -selector: "testUnboxedObjects", +selector: "testDynamicDictionaries", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -$4="foo"._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$3=[$4,"foo"._yourself()]; -$2=$recv($3)._asSet(); -$1=$recv($2)._asArray(); -self._assert_equals_($1,["foo"]); +self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1)))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asArray", "asSet", "yourself"] +source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)", +referencedClasses: ["HashedCollection"], +messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"] }), -$globals.SetTest); +$globals.HashedCollectionTest); + $core.addMethod( $core.method({ -selector: "testUnicity", -protocol: 'tests', +selector: "collectionClass", +protocol: 'fixture', fn: function (){ var self=this; -var set; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -set=$recv($Set())._new(); -$recv(set)._add_((21)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=1; -//>>excludeEnd("ctx"); -$recv(set)._add_("hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=2; -//>>excludeEnd("ctx"); -$recv(set)._add_((21)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["add:"]=3; -//>>excludeEnd("ctx"); -$1=$recv(set)._size(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["size"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(set)._add_("hello"); -self._assert_equals_($recv(set)._size(),(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(set)._asArray(),[(21), "hello"]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)}); -//>>excludeEnd("ctx"); +function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} +return $HashedCollection(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: ["new", "add:", "assert:equals:", "size", "asArray"] +source: "collectionClass\x0a\x09^ HashedCollection", +referencedClasses: ["HashedCollection"], +messageSends: [] }), -$globals.SetTest); +$globals.HashedCollectionTest.klass); +$core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionClass", +selector: "collectionFirst", protocol: 'fixture', fn: function (){ var self=this; -function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -return $Set(); - +return $core.withContext(function($ctx1) { +self._subclassResponsibility(); +return self; +}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ Set", -referencedClasses: ["Set"], -//>>excludeEnd("ide"); -messageSends: [] +source: "collectionFirst\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] }), -$globals.SetTest.klass); - +$globals.SequenceableCollectionTest); -$core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testShow", -protocol: 'tests', +selector: "collectionFirstTwo", +protocol: 'fixture', fn: function (){ var self=this; -var originalTranscript; -function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -originalTranscript=$recv($Transcript())._current(); -$recv($Transcript())._register_($recv($ConsoleTranscript())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["register:"]=1; -//>>excludeEnd("ctx"); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Transcript())._show_("Hello console!"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["show:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["shouldnt:raise:"]=1; -//>>excludeEnd("ctx"); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($Transcript())._show_(console); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -$recv($Transcript())._register_(originalTranscript); +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.", -referencedClasses: ["Transcript", "ConsoleTranscript", "Error"], -//>>excludeEnd("ide"); -messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"] +source: "collectionFirstTwo\x0a\x09self subclassResponsibility", +referencedClasses: [], +messageSends: ["subclassResponsibility"] }), -$globals.ConsoleTranscriptTest); - - +$globals.SequenceableCollectionTest); -$core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "jsNull", -protocol: 'accessing', +selector: "collectionLast", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return null; +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "jsNull\x0a\x09", +source: "collectionLast\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "jsObject", -protocol: 'accessing', +selector: "collectionLastTwo", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}; +self._subclassResponsibility(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "jsObject\x0a\x09", +source: "collectionLastTwo\x0a\x09self subclassResponsibility", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["subclassResponsibility"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "jsUndefined", -protocol: 'accessing', -fn: function (){ +selector: "nonIndexesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return; +$recv(aBlock)._value_((0)); +$ctx1.sendIdx["value:"]=1; +$recv(aBlock)._value_($recv(self._collectionSize()).__plus((1))); +$ctx1.sendIdx["value:"]=2; +$recv(aBlock)._value_("z"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "jsUndefined\x0a\x09", +args: ["aBlock"], +source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["value:", "+", "collectionSize"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testAtIfAbsent", -protocol: 'tests', -fn: function (){ +selector: "samplesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -var testObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -testObject=self._jsObject(); -$1=$recv(testObject)._at_ifAbsent_("abc",(function(){ -return "Property does not exist"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"Property does not exist"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(testObject)._at_ifAbsent_("e",(function(){ -return "Property does not exist"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$3=$recv(testObject)._at_ifAbsent_("a",(function(){ -return "Property does not exist"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifAbsent:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){ -return "Property does not exist"; - -})),nil); +$recv(aBlock)._value_value_((1),self._collectionFirst()); +$ctx1.sendIdx["value:value:"]=1; +$recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.", +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"] +messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testAtIfPresent", +selector: "testBeginsWith", protocol: 'tests', fn: function (){ var self=this; -var testObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5; -testObject=self._jsObject(); -$1=$recv(testObject)._at_ifPresent_("abc",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=1; -//>>excludeEnd("ctx"); -return "hello ".__comma($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(testObject)._at_ifPresent_("e",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=2; -//>>excludeEnd("ctx"); -return "hello ".__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,"hello nil"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$5=$recv(testObject)._at_ifPresent_("a",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$6=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=3; -//>>excludeEnd("ctx"); -return "hello ".__comma($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"hello 1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello ".__comma($recv(x)._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)}); -//>>excludeEnd("ctx"); -})),"hello nil"); +var $2,$1,$4,$5,$3,$7,$6; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._beginsWith_($recv(self._collectionClass())._new()); +$ctx1.sendIdx["beginsWith:"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$5=self._collection(); +$ctx1.sendIdx["collection"]=3; +$3=$recv($4)._beginsWith_($5); +$ctx1.sendIdx["beginsWith:"]=2; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +$7=self._collection(); +$ctx1.sendIdx["collection"]=4; +$6=$recv($7)._beginsWith_(self._collectionFirstTwo()); +$ctx1.sendIdx["beginsWith:"]=3; +self._assert_($6); +self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.", +source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"] +messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testAtIfPresentIfAbsent", +selector: "testEndsWith", protocol: 'tests', fn: function (){ var self=this; -var testObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3,$6,$5; -testObject=self._jsObject(); -$1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$2=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=1; -//>>excludeEnd("ctx"); -return "hello ".__comma($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),(function(){ -return "not present"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"not present"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$4=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=2; -//>>excludeEnd("ctx"); -return "hello ".__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)}); -//>>excludeEnd("ctx"); -}),(function(){ -return "not present"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($3,"hello nil"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$6=$recv(x)._asString(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["asString"]=3; -//>>excludeEnd("ctx"); -return "hello ".__comma($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)}); -//>>excludeEnd("ctx"); -}),(function(){ -return "not present"; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"hello 1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return "hello ".__comma($recv(x)._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)}); -//>>excludeEnd("ctx"); -}),(function(){ -return "not present"; - -})),"hello nil"); +var $2,$1,$4,$5,$3,$7,$6; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._endsWith_($recv(self._collectionClass())._new()); +$ctx1.sendIdx["endsWith:"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$5=self._collection(); +$ctx1.sendIdx["collection"]=3; +$3=$recv($4)._endsWith_($5); +$ctx1.sendIdx["endsWith:"]=2; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +$7=self._collection(); +$ctx1.sendIdx["collection"]=4; +$6=$recv($7)._endsWith_(self._collectionLastTwo()); +$ctx1.sendIdx["endsWith:"]=3; +self._assert_($6); +self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.", +source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"] +messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testAtPut", +selector: "testFirst", protocol: 'tests', fn: function (){ var self=this; -var testObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -testObject=self._jsObject(); -$2=$recv(testObject)._at_("abc"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__tild_eq("xyz"); -self._assert_($1); -self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(testObject)._at_("abc"),"xyz"); +self._assert_equals_($recv(self._collection())._first(),self._collectionFirst()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'", +source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"] +messageSends: ["assert:equals:", "first", "collection", "collectionFirst"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testComparison", +selector: "testFirstN", protocol: 'tests', fn: function (){ var self=this; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -self._assert_equals_($recv([console,(2)])._indexOf_(console),(1)); -$1=$recv(console).__eq(console); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -$2=$recv(console).__eq($recv($Object())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -self._deny_($recv(console).__eq(self._jsObject())); +var $2,$1,$4,$3,$6,$5,$7; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._first_((2)); +$ctx1.sendIdx["first:"]=1; +self._assert_equals_($1,self._collectionFirstTwo()); +$ctx1.sendIdx["assert:equals:"]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$3=$recv($4)._first_((0)); +$ctx1.sendIdx["first:"]=2; +self._assert_equals_($3,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=2; +$6=self._collection(); +$ctx1.sendIdx["collection"]=3; +$5=$recv($6)._first_(self._collectionSize()); +$ctx1.sendIdx["first:"]=3; +$7=self._collection(); +$ctx1.sendIdx["collection"]=4; +self._assert_equals_($5,$7); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._collection())._first_((33)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"] +source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testDNU", +selector: "testFourth", protocol: 'tests', fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self._jsObject())._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); +var $2,$1; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._fourth(); +self._assert_equals_($1,$recv(self._collection())._at_((4))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "foo", "jsObject"] +source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)", +referencedClasses: [], +messageSends: ["assert:equals:", "fourth", "collection", "at:"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testDNURegression1057", +selector: "testIndexOfStartingAt", protocol: 'tests', fn: function (){ var self=this; -var jsObject; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsNull; +function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -jsObject=[]; -$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:put:"]=1; -//>>excludeEnd("ctx"); -$recv(jsObject)._basicAt_put_("foo",(3)); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(jsObject)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["foo"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["shouldnt:raise:"]=1; -//>>excludeEnd("ctx"); -$1=$recv(jsObject)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["foo"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$1,$4,$3; +jsNull=$recv($JSON())._parse_("null"); +self._samplesDo_((function(index,value){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(jsObject)._foo_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -self._assert_equals_($recv(jsObject)._foo(),(4)); +$2=self._collection(); +$ctx2.sendIdx["collection"]=1; +$1=$recv($2)._indexOf_startingAt_(value,(1)); +$ctx2.sendIdx["indexOf:startingAt:"]=1; +self._assert_equals_($1,index); +$ctx2.sendIdx["assert:equals:"]=1; +$4=self._collection(); +$ctx2.sendIdx["collection"]=2; +$3=$recv($4)._indexOf_startingAt_(value,index); +$ctx2.sendIdx["indexOf:startingAt:"]=2; +self._assert_equals_($3,index); +$ctx2.sendIdx["assert:equals:"]=2; +return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0)); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"] +source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]", +referencedClasses: ["JSON"], +messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testDNURegression1059", +selector: "testIndexOfStartingAtWithNull", protocol: 'tests', fn: function (){ var self=this; -var jsObject; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsNull; +function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -jsObject=[]; -$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:put:"]=1; -//>>excludeEnd("ctx"); -$recv(jsObject)._basicAt_put_("x",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:put:"]=2; -//>>excludeEnd("ctx"); -$recv(jsObject)._basicAt_put_("x:",(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2; +jsNull=$recv($JSON())._parse_("null"); +self._samplesDo_((function(index,value){ +var collection; return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._error(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); +collection=self._collection(); +collection; +$recv(collection)._at_put_(index,jsNull); +$1=$recv(collection)._indexOf_startingAt_(jsNull,(1)); +$ctx2.sendIdx["indexOf:startingAt:"]=1; +self._assert_equals_($1,index); +$ctx2.sendIdx["assert:equals:"]=1; +$2=$recv(collection)._indexOf_startingAt_(jsNull,index); +$ctx2.sendIdx["indexOf:startingAt:"]=2; +self._assert_equals_($2,index); +$ctx2.sendIdx["assert:equals:"]=2; +return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0)); +}, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)}); })); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(jsObject)._x_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -self._assert_equals_($recv(jsObject)._x(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"] +source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]", +referencedClasses: ["JSON"], +messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testDNURegression1062", +selector: "testLast", protocol: 'tests', fn: function (){ var self=this; -var jsObject,stored; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -jsObject=[]; -$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:put:"]=1; -//>>excludeEnd("ctx"); -$recv(jsObject)._basicAt_put_("x",(function(v){ -stored=v; -return stored; - -})); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(jsObject)._x_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$Error()); -self._assert_equals_(stored,(4)); +self._assert_equals_($recv(self._collection())._last(),self._collectionLast()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"] +source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast", +referencedClasses: [], +messageSends: ["assert:equals:", "last", "collection", "collectionLast"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testDNUWithAllowJavaScriptCalls", +selector: "testLastN", protocol: 'tests', fn: function (){ var self=this; -var jsObject; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -jsObject=[]; -$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); +var $2,$1,$4,$3,$6,$5,$7; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._last_((2)); +$ctx1.sendIdx["last:"]=1; +self._assert_equals_($1,self._collectionLastTwo()); +$ctx1.sendIdx["assert:equals:"]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$3=$recv($4)._last_((0)); +$ctx1.sendIdx["last:"]=2; +self._assert_equals_($3,$recv(self._collectionClass())._new()); +$ctx1.sendIdx["assert:equals:"]=2; +$6=self._collection(); +$ctx1.sendIdx["collection"]=3; +$5=$recv($6)._last_(self._collectionSize()); +$ctx1.sendIdx["last:"]=3; +$7=self._collection(); +$ctx1.sendIdx["collection"]=4; +self._assert_equals_($5,$7); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(jsObject)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(self._collection())._last_((33)); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["basicAt:put:", "should:raise:", "foo"] +source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testMessageSend", +selector: "testSecond", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$4,$3; -$2=self._jsObject(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["jsObject"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._a(); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$4=self._jsObject(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["jsObject"]=2; -//>>excludeEnd("ctx"); -$3=$recv($4)._b(); -self._assert_equals_($3,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._jsObject())._c_((3)),(3)); +var $2,$1; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._second(); +self._assert_equals_($1,$recv(self._collection())._at_((2))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3", +source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"] +messageSends: ["assert:equals:", "second", "collection", "at:"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); $core.addMethod( $core.method({ -selector: "testMethodWithArguments", +selector: "testThird", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._jsObject())._c_((1)),(1)); +var $2,$1; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$1=$recv($2)._third(); +self._assert_equals_($1,$recv(self._collection())._at_((3))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1", +source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "c:", "jsObject"] +messageSends: ["assert:equals:", "third", "collection", "at:"] }), -$globals.JSObjectProxyTest); +$globals.SequenceableCollectionTest); + + +$core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testPrinting", -protocol: 'tests', +selector: "collection", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1), (2), (3), (-4)]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'", +source: "collection\x0a\x09^ #(1 2 3 -4)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "printString", "jsObject"] +messageSends: [] }), -$globals.JSObjectProxyTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testPropertyThatReturnsEmptyString", -protocol: 'tests', +selector: "collectionFirst", +protocol: 'fixture', fn: function (){ var self=this; -var object; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -object=self._jsObject(); -$1=$recv(object)._d(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["d"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(object)._d_("hello"); -self._assert_equals_($recv(object)._d(),"hello"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +return (1); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'", +source: "collectionFirst\x0a\x09^ 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:equals:", "d", "d:"] +messageSends: [] }), -$globals.JSObjectProxyTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testPropertyThatReturnsUndefined", -protocol: 'tests', +selector: "collectionFirstTwo", +protocol: 'fixture', fn: function (){ var self=this; -var object; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -object=self._jsObject(); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(object)._e(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["e"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -self._assert_($recv($recv(object)._e())._isNil()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1), (2)]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"] +source: "collectionFirstTwo\x0a\x09^ #(1 2)", +referencedClasses: [], +messageSends: [] }), -$globals.JSObjectProxyTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testSetPropertyWithFalsyValue", -protocol: 'tests', +selector: "collectionLast", +protocol: 'fixture', fn: function (){ var self=this; -var jsObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5; -jsObject=self._jsObject(); -$1=$recv(jsObject)._a(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(jsObject)._a_(self._jsNull()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(jsObject)._a(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$recv(jsObject)._a_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a:"]=2; -//>>excludeEnd("ctx"); -$3=$recv(jsObject)._a(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$recv(jsObject)._a_(self._jsUndefined()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a:"]=3; -//>>excludeEnd("ctx"); -$4=$recv(jsObject)._a(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($4,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$recv(jsObject)._a_(""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a:"]=4; -//>>excludeEnd("ctx"); -$5=$recv(jsObject)._a(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["a"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($5,""); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$recv(jsObject)._a_(false); -self._assert_equals_($recv(jsObject)._a(),false); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +return (-4); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false", +source: "collectionLast\x0a\x09^ -4", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"] +messageSends: [] }), -$globals.JSObjectProxyTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testValue", -protocol: 'tests', +selector: "collectionLastTwo", +protocol: 'fixture', fn: function (){ var self=this; -var testObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -testObject=self._jsObject(); -$recv(testObject)._at_put_("value","aValue"); -self._assert_equals_($recv(testObject)._value(),"aValue"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(3), (-4)]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'", +source: "collectionLastTwo\x0a\x09^ #(3 -4)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["jsObject", "at:put:", "assert:equals:", "value"] +messageSends: [] }), -$globals.JSObjectProxyTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testYourself", -protocol: 'tests', +selector: "collectionOfPrintStrings", +protocol: 'fixture', fn: function (){ var self=this; -var object; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=self._jsObject(); -$recv($1)._d_("test"); -$2=$recv($1)._yourself(); -object=$2; -self._assert_equals_($recv(object)._d(),"test"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=["1", "2", "3", "-4"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'", +source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"] +messageSends: [] }), -$globals.JSObjectProxyTest); - - +$globals.ArrayTest); -$core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testCatchingException", -protocol: 'tests', +selector: "collectionSize", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._throwException(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._assert_($recv($recv(error)._exception()).__eq("test")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)}); -//>>excludeEnd("ctx"); +return (4); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["on:do:", "throwException", "assert:", "=", "exception"] +source: "collectionSize\x0a\x09^ 4", +referencedClasses: [], +messageSends: [] }), -$globals.JavaScriptExceptionTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testRaisingException", -protocol: 'tests', +selector: "collectionWithDuplicates", +protocol: 'fixture', fn: function (){ var self=this; -function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._throwException(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$JavaScriptException()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=["a", "b", "c", (1), (2), (1), "a"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException", -referencedClasses: ["JavaScriptException"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "throwException"] +source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')", +referencedClasses: [], +messageSends: [] }), -$globals.JavaScriptExceptionTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "throwException", -protocol: 'helpers', +selector: "collectionWithNewValue", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -throw 'test'; -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[(1), (2), (3), (-4), "N"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "throwException\x0a\x09", +source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), -$globals.JavaScriptExceptionTest); - - +$globals.ArrayTest); -$core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testValue", -protocol: 'tests', +selector: "sampleNewIndex", +protocol: 'fixture', fn: function (){ var self=this; -var messageSend; -function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)} -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($MessageSend())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._receiver_($recv($Object())._new()); -$recv($1)._selector_("asString"); -$2=$recv($1)._yourself(); -messageSend=$2; -self._assert_equals_($recv(messageSend)._value(),"an Object"); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)}); -//>>excludeEnd("ctx"); +return (5); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'", -referencedClasses: ["MessageSend", "Object"], -//>>excludeEnd("ide"); -messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"] +source: "sampleNewIndex\x0a\x09^ 5", +referencedClasses: [], +messageSends: [] }), -$globals.MessageSendTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "testValueWithArguments", -protocol: 'tests', -fn: function (){ +selector: "samplesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -var messageSend; -function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($MessageSend())._new(); -$recv($1)._receiver_((2)); -$recv($1)._selector_("+"); -$2=$recv($1)._yourself(); -messageSend=$2; -self._assert_equals_($recv(messageSend)._value_((3)),(5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6)); +( +$ctx1.supercall = true, +$globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); +$ctx1.supercall = false; +$recv(aBlock)._value_value_((3),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6", -referencedClasses: ["MessageSend"], -//>>excludeEnd("ide"); -messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"] +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.", +referencedClasses: [], +messageSends: ["samplesDo:", "value:value:"] }), -$globals.MessageSendTest); - - +$globals.ArrayTest); -$core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "codeGeneratorClass", -protocol: 'accessing', +selector: "testAdd", +protocol: 'tests', fn: function (){ var self=this; -function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)} -return $CodeGenerator(); - +var array; +return $core.withContext(function($ctx1) { +array=self._collection(); +$recv(array)._add_((6)); +self._assert_equals_($recv(array)._last(),(6)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "codeGeneratorClass\x0a\x09^ CodeGenerator", -referencedClasses: ["CodeGenerator"], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6", +referencedClasses: [], +messageSends: ["collection", "add:", "assert:equals:", "last"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "compiler", -protocol: 'factory', +selector: "testAddFirst", +protocol: 'tests', fn: function (){ var self=this; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Compiler())._new(); -$recv($2)._codeGeneratorClass_(self._codeGeneratorClass()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +var $1,$2; +$1=self._collection(); +$recv($1)._addFirst_((0)); +$2=$recv($1)._yourself(); +self._assert_equals_($recv($2)._first(),(0)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself", -referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); -messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"] +source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0", +referencedClasses: [], +messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "deinstallBottom", -protocol: 'testing', +selector: "testPrintString", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]); +var $1,$2,$3,$4,$5,$6,$7,$8,$9; +array=$recv($Array())._new(); +$1=$recv(array)._printString(); +$ctx1.sendIdx["printString"]=1; +self._assert_equals_($1,"an Array ()"); +$ctx1.sendIdx["assert:equals:"]=1; +$2=array; +$recv($2)._add_((1)); +$ctx1.sendIdx["add:"]=1; +$3=$recv($2)._add_((3)); +$ctx1.sendIdx["add:"]=2; +$4=$recv(array)._printString(); +$ctx1.sendIdx["printString"]=2; +self._assert_equals_($4,"an Array (1 3)"); +$ctx1.sendIdx["assert:equals:"]=2; +$recv(array)._add_("foo"); +$5=$recv(array)._printString(); +$ctx1.sendIdx["printString"]=3; +self._assert_equals_($5,"an Array (1 3 'foo')"); +$ctx1.sendIdx["assert:equals:"]=3; +$6=array; +$recv($6)._remove_((1)); +$ctx1.sendIdx["remove:"]=1; +$7=$recv($6)._remove_((3)); +$8=$recv(array)._printString(); +$ctx1.sendIdx["printString"]=4; +self._assert_equals_($8,"an Array ('foo')"); +$ctx1.sendIdx["assert:equals:"]=4; +$recv(array)._addLast_((3)); +$ctx1.sendIdx["addLast:"]=1; +$9=$recv(array)._printString(); +$ctx1.sendIdx["printString"]=5; +self._assert_equals_($9,"an Array ('foo' 3)"); +$ctx1.sendIdx["assert:equals:"]=5; +$recv(array)._addLast_((3)); +self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["removeCompiledMethod:", "targetClassBottom"] +source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.", +referencedClasses: ["Array"], +messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "deinstallMiddle", -protocol: 'testing', +selector: "testRemove", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]); +array=[(1), (2), (3), (4), (5)]; +$recv(array)._remove_((3)); +$ctx1.sendIdx["remove:"]=1; +self._assert_equals_(array,[(1), (2), (4), (5)]); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(array)._remove_((3)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["removeCompiledMethod:", "targetClassMiddle"] +source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["remove:", "assert:equals:", "should:raise:"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "deinstallTop", -protocol: 'testing', +selector: "testRemoveFromTo", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]); +var $1,$2; +$1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3)); +$ctx1.sendIdx["removeFrom:to:"]=1; +self._assert_equals_($1,[(4)]); +$ctx1.sendIdx["assert:equals:"]=1; +$2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3)); +$ctx1.sendIdx["removeFrom:to:"]=2; +self._assert_equals_($2,[(1), (4)]); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method", +source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["removeCompiledMethod:", "targetClassTop"] +messageSends: ["assert:equals:", "removeFrom:to:"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "installBottom:", -protocol: 'testing', -fn: function (aString){ +selector: "testRemoveIndex", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests"); +var $1,$2; +$1=[(1), (2), (3), (4)]._removeIndex_((2)); +$ctx1.sendIdx["removeIndex:"]=1; +self._assert_equals_($1,[(1), (3), (4)]); +$ctx1.sendIdx["assert:equals:"]=1; +$2=[(1), (2), (3), (4)]._removeIndex_((1)); +$ctx1.sendIdx["removeIndex:"]=2; +self._assert_equals_($2,[(2), (3), (4)]); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_(["hello"]._removeIndex_((1)),[]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'", +args: [], +source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"] +messageSends: ["assert:equals:", "removeIndex:"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "installMiddle:", -protocol: 'testing', -fn: function (aString){ +selector: "testRemoveLast", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests"); +array=[(1), (2)]; +$recv(array)._removeLast(); +self._assert_equals_($recv(array)._last(),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'", +args: [], +source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"] +messageSends: ["removeLast", "assert:equals:", "last"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "installTop:", -protocol: 'testing', -fn: function (aString){ +selector: "testReversed", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests"); +array=[(5), (4), (3), (2), (1)]; +self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'", +args: [], +source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"] +messageSends: ["assert:equals:", "reversed"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'initialization', +selector: "testSort", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var array; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@receiverTop"]=$recv(self._targetClassTop())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -self["@receiverBottom"]=$recv(self._targetClassBottom())._new(); -self["@method"]=nil; -self["@performBlock"]=(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._error_("performBlock not initialized"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); +array=[(10), (1), (5)]; +$recv(array)._sort(); +self._assert_equals_(array,[(1), (5), (10)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]", +source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"] +messageSends: ["sort", "assert:equals:"] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest); + $core.addMethod( $core.method({ -selector: "shouldMNU", -protocol: 'testing', +selector: "collectionClass", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._shouldMNUTop(); -self._shouldMNUMiddle(); -self._shouldMNUBottom(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $Array(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"] +source: "collectionClass\x0a\x09^ Array", +referencedClasses: ["Array"], +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.ArrayTest.klass); + +$core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "shouldMNUBottom", -protocol: 'testing', +selector: "collection", +protocol: 'fixture', fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@performBlock"])._value_(self["@receiverBottom"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "helLo"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "value:"] +source: "collection\x0a\x09^ 'helLo'", +referencedClasses: [], +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "shouldMNUMiddle", -protocol: 'testing', +selector: "collectionFirst", +protocol: 'fixture', fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "h"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "value:"] +source: "collectionFirst\x0a\x09^ 'h'", +referencedClasses: [], +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "shouldMNUTop", -protocol: 'testing', +selector: "collectionFirstTwo", +protocol: 'fixture', fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@performBlock"])._value_(self["@receiverTop"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "he"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "value:"] +source: "collectionFirstTwo\x0a\x09^ 'he'", +referencedClasses: [], +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "shouldReturn:", -protocol: 'testing', -fn: function (anObject){ +selector: "collectionLast", +protocol: 'fixture', +fn: function (){ var self=this; -var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverTop"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(["top",anObject],["top",result]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_(["middle",anObject],["middle",result]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]); -self._assert_equals_(["bottom",anObject],["bottom",result]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "o"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }", +args: [], +source: "collectionLast\x0a\x09^ 'o'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:", "assert:equals:"] +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "shouldReturn:and:and:", -protocol: 'testing', -fn: function (anObject,anObject2,anObject3){ +selector: "collectionLastTwo", +protocol: 'fixture', +fn: function (){ var self=this; -var result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverTop"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(["top",anObject],["top",result]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["value:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_(["middle",anObject2],["middle",result]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]); -self._assert_equals_(["bottom",anObject3],["bottom",result]); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "Lo"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject", "anObject2", "anObject3"], -source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }", +args: [], +source: "collectionLastTwo\x0a\x09^ 'Lo'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["value:", "assert:equals:"] +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "targetClassBottom", -protocol: 'accessing', +selector: "collectionOfPrintStrings", +protocol: 'fixture', fn: function (){ var self=this; -function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} -return $JavaScriptException(); +return "'h''e''l''L''o'"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "targetClassBottom\x0a\x09^ JavaScriptException", -referencedClasses: ["JavaScriptException"], -//>>excludeEnd("ide"); +source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''", +referencedClasses: [], messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "targetClassMiddle", -protocol: 'accessing', +selector: "collectionSize", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -return $Error(); +return (5); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "targetClassMiddle\x0a\x09^ Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); +source: "collectionSize\x0a\x09^ 5", +referencedClasses: [], messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "targetClassTop", -protocol: 'accessing', +selector: "collectionWithDuplicates", +protocol: 'fixture', fn: function (){ var self=this; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -return $Object(); +return "abbaerte"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "targetClassTop\x0a\x09^ Object", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); +source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'", +referencedClasses: [], messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "tearDown", -protocol: 'initialization', +selector: "collectionWithNewValue", +protocol: 'fixture', fn: function (){ var self=this; -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._deinstallTop(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(){ - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._deinstallMiddle(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(){ - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["on:do:"]=2; -//>>excludeEnd("ctx"); -$recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return self._deinstallBottom(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); -}))._on_do_($Error(),(function(){ +return "helLoN"; -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"] +source: "collectionWithNewValue\x0a\x09^ 'helLoN'", +referencedClasses: [], +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testMNU11", -protocol: 'tests', +selector: "sampleNewValueAsCollection", +protocol: 'fixture', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@performBlock"]=(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); -self._shouldMNU(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["shouldMNU"]=1; -//>>excludeEnd("ctx"); -self._installTop_("foo ^ false"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["installTop:"]=1; -//>>excludeEnd("ctx"); -self._installTop_("foo ^ true"); -self._deinstallTop(); -self._shouldMNU(); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +return "N"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU", +source: "sampleNewValueAsCollection\x0a\x09^ 'N'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"] +messageSends: [] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testMNU22", -protocol: 'tests', -fn: function (){ +selector: "samplesDo:", +protocol: 'fixture', +fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@performBlock"]=(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); -self._shouldMNU(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["shouldMNU"]=1; -//>>excludeEnd("ctx"); -self._installMiddle_("foo ^ false"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["installMiddle:"]=1; -//>>excludeEnd("ctx"); -self._installMiddle_("foo ^ true"); -self._deinstallMiddle(); -self._shouldMNU(); +( +$ctx1.supercall = true, +$globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock])); +$ctx1.supercall = false; +$recv(aBlock)._value_value_((3),"l"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU", +args: ["aBlock"], +source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"] +messageSends: ["samplesDo:", "value:value:"] }), -$globals.MethodInheritanceTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testReturns1", +selector: "testAddAll", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@performBlock"]=(function(x){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +self._should_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(x)._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); -//>>excludeEnd("ctx"); -}); -self._installTop_("foo ^ false"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["installTop:"]=1; -//>>excludeEnd("ctx"); -self._shouldReturn_(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["shouldReturn:"]=1; -//>>excludeEnd("ctx"); -self._installTop_("foo ^ true"); -self._shouldReturn_(true); +$1=self._collection(); +$ctx2.sendIdx["collection"]=1; +return $recv($1)._addAll_(self._collection()); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["foo", "installTop:", "shouldReturn:"] +source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "addAll:", "collection"] }), -$globals.MethodInheritanceTest); - - +$globals.StringTest); -$core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAbs", +selector: "testAddRemove", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=(4)._abs(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["abs"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((-4)._abs(),(4)); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return "hello"._add_("a"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); +$ctx1.sendIdx["should:raise:"]=1; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return "hello"._remove_("h"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "abs"] +source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "add:", "remove:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testArithmetic", +selector: "testAsArray", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4; -$1=(1.5).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(2.5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(2).__minus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["-"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((-2).__minus((1)),(-3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_((12).__slash((2)),(6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$3=(3).__star((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["*"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(12)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_((7).__slash_slash((2)),(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -self._assert_equals_((7).__backslash_backslash((2)),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=7; -//>>excludeEnd("ctx"); -$5=(1).__plus((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["+"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5).__star((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["*"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($4,(9)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=8; -//>>excludeEnd("ctx"); -self._assert_equals_((1).__plus((2).__star((3))),(7)); +self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7", +source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"] +messageSends: ["assert:equals:", "asArray"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testAsNumber", +selector: "testAsLowerCase", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((3)._asNumber(),(3)); +self._assert_equals_("JACKIE"._asLowercase(),"jackie"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.", +source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "asNumber"] +messageSends: ["assert:equals:", "asLowercase"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testCeiling", +selector: "testAsNumber", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; -$1=(1.2)._ceiling(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ceiling"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1="3"._asNumber(); +$ctx1.sendIdx["asNumber"]=1; +self._assert_equals_($1,(3)); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(-1.2)._ceiling(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["ceiling"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(-1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$2="-3"._asNumber(); +$ctx1.sendIdx["asNumber"]=2; +self._assert_equals_($2,(-3)); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((1)._ceiling(),(1)); +self._assert_equals_("-1.5"._asNumber(),(-1.5)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.", +source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ceiling"] +messageSends: ["assert:equals:", "asNumber"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testComparison", +selector: "testAsUpperCase", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$1=(3).__gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=(2).__lt((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["<"]=1; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -self._deny_((3).__lt((2))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -self._deny_((2).__gt((3))); -$3=(3).__gt_eq((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">="]=1; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -self._assert_((3.1).__gt_eq((3))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=4; -//>>excludeEnd("ctx"); -$4=(3).__lt_eq((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["<="]=1; -//>>excludeEnd("ctx"); -self._assert_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=5; -//>>excludeEnd("ctx"); -self._assert_((3).__lt_eq((3.1))); +self._assert_equals_("jackie"._asUppercase(),"JACKIE"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1", +source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", ">", "<", "deny:", ">=", "<="] +messageSends: ["assert:equals:", "asUppercase"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testCopying", +selector: "testAsciiValue", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var characterA,characterU; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=$recv((1)._copy()).__eq_eq((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -self._assert_($recv((1)._deepCopy()).__eq_eq((1))); +characterA="A"; +characterU="U"; +$1=$recv(characterA)._asciiValue(); +$ctx1.sendIdx["asciiValue"]=1; +self._assert_equals_($1,(65)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv(characterU)._asciiValue(),(85)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1", +source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "==", "copy", "deepCopy"] +messageSends: ["assert:equals:", "asciiValue"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testEquality", +selector: "testAtIfAbsentPut", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12; -$1=(1).__eq((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=(0).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$3=(1).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$5=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=4; -//>>excludeEnd("ctx"); -self._assert_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$7=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$6=(1).__eq($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=5; -//>>excludeEnd("ctx"); -self._assert_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=4; -//>>excludeEnd("ctx"); -$9=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -$8=$recv($9).__eq((1)._yourself()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=6; -//>>excludeEnd("ctx"); -self._assert_($8); -$10=(0).__eq(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=7; -//>>excludeEnd("ctx"); -self._deny_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$11=false.__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=8; -//>>excludeEnd("ctx"); -self._deny_($11); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$12="".__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=9; -//>>excludeEnd("ctx"); -self._deny_($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=4; -//>>excludeEnd("ctx"); -self._deny_((0).__eq("")); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return "hello"._at_ifAbsentPut_((6),(function(){ +return "a"; + +})); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "=", "deny:", "yourself"] +source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "at:ifAbsentPut:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testFloor", +selector: "testAtPut", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=(1.2)._floor(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["floor"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(-1.2)._floor(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["floor"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(-2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((1)._floor(),(1)); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return "hello"._at_put_((1),"a"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "floor"] +source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "at:put:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testHexNumbers", +selector: "testCapitalized", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$5; -self._assert_equals_((9),(9)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3; +$1="test"._capitalized(); +$ctx1.sendIdx["capitalized"]=1; +self._assert_equals_($1,"Test"); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$1=(10)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(10)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$2="Test"._capitalized(); +$ctx1.sendIdx["capitalized"]=2; +self._assert_equals_($2,"Test"); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$2=(11)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(11)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._assert_equals_(""._capitalized(),""); $ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$3=(12)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(12)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$3="Test"._isCapitalized(); +$ctx1.sendIdx["isCapitalized"]=1; +self._assert_equals_($3,true); $ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$4=(13)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($4,(13)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$5=(14)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($5,(14)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -self._assert_equals_((15)._truncated(),(15)); +self._assert_equals_("test"._isCapitalized(),false); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15", +source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "truncated"] +messageSends: ["assert:equals:", "capitalized", "isCapitalized"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testIdentity", +selector: "testCharCodeAt", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$4,$7,$6,$9,$8; -$1=(1).__eq_eq((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=(0).__eq_eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$3=(1).__eq_eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=3; -//>>excludeEnd("ctx"); -self._deny_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$5=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq_eq((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=4; -//>>excludeEnd("ctx"); -self._assert_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$7=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=2; -//>>excludeEnd("ctx"); -$6=(1).__eq_eq($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=5; -//>>excludeEnd("ctx"); -self._assert_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=4; -//>>excludeEnd("ctx"); -$9=(1)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=3; -//>>excludeEnd("ctx"); -$8=$recv($9).__eq_eq((1)._yourself()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=6; -//>>excludeEnd("ctx"); -self._assert_($8); -self._deny_((1).__eq_eq((2))); +var $1,$2,$3,$4,$5; +$1="jackie"._charCodeAt_((1)); +$ctx1.sendIdx["charCodeAt:"]=1; +self._assert_equals_($1,(106)); +$ctx1.sendIdx["assert:equals:"]=1; +$2="jackie"._charCodeAt_((2)); +$ctx1.sendIdx["charCodeAt:"]=2; +self._assert_equals_($2,(97)); +$ctx1.sendIdx["assert:equals:"]=2; +$3="jackie"._charCodeAt_((3)); +$ctx1.sendIdx["charCodeAt:"]=3; +self._assert_equals_($3,(99)); +$ctx1.sendIdx["assert:equals:"]=3; +$4="jackie"._charCodeAt_((4)); +$ctx1.sendIdx["charCodeAt:"]=4; +self._assert_equals_($4,(107)); +$ctx1.sendIdx["assert:equals:"]=4; +$5="jackie"._charCodeAt_((5)); +$ctx1.sendIdx["charCodeAt:"]=5; +self._assert_equals_($5,(105)); +$ctx1.sendIdx["assert:equals:"]=5; +self._assert_equals_("jackie"._charCodeAt_((6)),(101)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2", +source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "==", "deny:", "yourself"] +messageSends: ["assert:equals:", "charCodeAt:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testInvalidHexNumbers", +selector: "testCopyFromTo", protocol: 'tests', fn: function (){ var self=this; -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rG(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=1; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rg(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=2; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rH(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=3; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rh(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=4; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rI(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=5; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._ri(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=6; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rJ(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=7; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rj(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=8; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rK(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=9; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rk(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=10; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rL(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=11; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rl(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=12; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rM(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=13; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rm(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=14; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rN(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=15; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rn(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=16; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rO(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=17; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._ro(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=18; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rP(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=19; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rp(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=20; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rQ(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=21; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rq(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=22; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rR(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=23; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rr(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=24; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rS(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=25; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rs(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=26; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rT(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=27; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rt(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=28; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rU(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=29; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._ru(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=30; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rV(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=31; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rv(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=32; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rW(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=33; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rw(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=34; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rX(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=35; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rx(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=36; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rY(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=37; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._ry(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=38; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rZ(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=39; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (16)._rz(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:raise:"]=40; -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (11259375)._Z(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); +var $1; +$1="jackie"._copyFrom_to_((1),(3)); +$ctx1.sendIdx["copyFrom:to:"]=1; +self._assert_equals_($1,"jac"); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)}); +}, +args: [], +source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.", +referencedClasses: [], +messageSends: ["assert:equals:", "copyFrom:to:"] +}), +$globals.StringTest); + +$core.addMethod( +$core.method({ +selector: "testCopyWithoutAll", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.", -referencedClasses: ["MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"] +source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'", +referencedClasses: [], +messageSends: ["assert:equals:", "copyWithoutAll:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testLog", +selector: "testEquality", protocol: 'tests', fn: function (){ var self=this; -function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((10000)._log(),(4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3; +self._assert_equals_("hello","hello"); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((512)._log_((2)),(9)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$1="hello".__eq("world"); +$ctx1.sendIdx["="]=1; +self._deny_($1); +$ctx1.sendIdx["deny:"]=1; +$2="hello".__eq([]._at_ifAbsent_((1),(function(){ + +}))); +$ctx1.sendIdx["="]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=2; +$3="hello"._yourself(); +$ctx1.sendIdx["yourself"]=1; +self._assert_equals_("hello",$3); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv($recv($Number())._e())._ln(),(1)); +self._assert_equals_("hello"._yourself(),"hello"); +self._deny_("".__eq((0))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.", -referencedClasses: ["Number"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "log", "log:", "ln", "e"] +source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0", +referencedClasses: [], +messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testMinMax", +selector: "testIdentity", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((2)._max_((5)),(5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((2)._min_((5)),(2)); +var $1,$2,$4,$3,$5; +$1="hello".__eq_eq("hello"); +$ctx1.sendIdx["=="]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2="hello".__eq_eq("world"); +$ctx1.sendIdx["=="]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=1; +$4="hello"._yourself(); +$ctx1.sendIdx["yourself"]=1; +$3="hello".__eq_eq($4); +$ctx1.sendIdx["=="]=3; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +$5=$recv("hello"._yourself()).__eq_eq("hello"); +$ctx1.sendIdx["=="]=4; +self._assert_($5); +self._deny_("".__eq_eq((0))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2", +source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "max:", "min:"] +messageSends: ["assert:", "==", "deny:", "yourself"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testNegated", +selector: "testIncludesSubString", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=(3)._negated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["negated"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(-3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((-3)._negated(),(3)); +$1="amber"._includesSubString_("ber"); +$ctx1.sendIdx["includesSubString:"]=1; +self._assert_($1); +self._deny_("amber"._includesSubString_("zork")); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3", +source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "negated"] +messageSends: ["assert:", "includesSubString:", "deny:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testPrintShowingDecimalPlaces", +selector: "testIndexOfStartingAtWithNull", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15; -$1=(23)._printShowingDecimalPlaces_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"23.00"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(23.5698)._printShowingDecimalPlaces_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,"23.57"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$4=(234.567)._negated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["negated"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._printShowingDecimalPlaces_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,"-234.56700"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$5=(23.4567)._printShowingDecimalPlaces_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"23"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -$6=(23.5567)._printShowingDecimalPlaces_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_($6,"24"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -$8=(23.4567)._negated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["negated"]=2; -//>>excludeEnd("ctx"); -$7=$recv($8)._printShowingDecimalPlaces_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=6; -//>>excludeEnd("ctx"); -self._assert_equals_($7,"-23"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=6; -//>>excludeEnd("ctx"); -$10=(23.5567)._negated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["negated"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10)._printShowingDecimalPlaces_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=7; -//>>excludeEnd("ctx"); -self._assert_equals_($9,"-24"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=7; -//>>excludeEnd("ctx"); -$11=(100000000)._printShowingDecimalPlaces_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=8; -//>>excludeEnd("ctx"); -self._assert_equals_($11,"100000000.0"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=8; -//>>excludeEnd("ctx"); -$12=(0.98)._printShowingDecimalPlaces_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=9; -//>>excludeEnd("ctx"); -self._assert_equals_($12,"0.98000"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=9; -//>>excludeEnd("ctx"); -$13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=10; -//>>excludeEnd("ctx"); -self._assert_equals_($13,"-0.98"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=10; -//>>excludeEnd("ctx"); -$14=(2.567)._printShowingDecimalPlaces_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=11; -//>>excludeEnd("ctx"); -self._assert_equals_($14,"2.57"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=11; -//>>excludeEnd("ctx"); -$15=(-2.567)._printShowingDecimalPlaces_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["printShowingDecimalPlaces:"]=12; -//>>excludeEnd("ctx"); -self._assert_equals_($15,"-2.57"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=12; -//>>excludeEnd("ctx"); -self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.", +source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"] +messageSends: [] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testRaisedTo", +selector: "testIndexOfWithNull", +protocol: 'tests', +fn: function (){ +var self=this; +return self; + +}, +args: [], +source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22", +referencedClasses: [], +messageSends: [] +}), +$globals.StringTest); + +$core.addMethod( +$core.method({ +selector: "testIsVowel", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var vowel,consonant; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -$1=(2)._raisedTo_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["raisedTo:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(16)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +vowel="u"; +consonant="z"; +$1=$recv(vowel)._isVowel(); +$ctx1.sendIdx["isVowel"]=1; +self._assert_equals_($1,true); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(2)._raisedTo_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["raisedTo:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$3=(2)._raisedTo_((-3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["raisedTo:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(0.125)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_((4)._raisedTo_((0.5)),(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_((2).__star_star((4)),(16)); +self._assert_equals_($recv(consonant)._isVowel(),false); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.", +source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "raisedTo:", "**"] +messageSends: ["assert:equals:", "isVowel"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testRounded", +selector: "testJoin", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=(3)._rounded(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["rounded"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(3.212)._rounded(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["rounded"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((3.51)._rounded(),(4)); +self._assert_equals_(","._join_(["hello", "world"]),"hello,world"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4", +source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "rounded"] +messageSends: ["assert:equals:", "join:"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testSign", +selector: "testRemoveAll", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=(5)._sign(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sign"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(0)._sign(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sign"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((-1.4)._sign(),(-1)); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._collection())._removeAll(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.", +source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["should:raise:", "removeAll", "collection"] +}), +$globals.StringTest); + +$core.addMethod( +$core.method({ +selector: "testReversed", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._assert_equals_("jackiechan"._reversed(),"nahceikcaj"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)}); +}, +args: [], +source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "sign"] +messageSends: ["assert:equals:", "reversed"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testSqrt", +selector: "testStreamContents", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -$1=(4)._sqrt(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["sqrt"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +self._assert_equals_($recv($String())._streamContents_((function(aStream){ +return $core.withContext(function($ctx2) { +$recv(aStream)._nextPutAll_("hello"); +$ctx2.sendIdx["nextPutAll:"]=1; +$recv(aStream)._space(); +$1=$recv(aStream)._nextPutAll_("world"); +return $1; +}, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)}); +})),"hello world"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)}); +}, +args: [], +source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'", +referencedClasses: ["String"], +messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"] +}), +$globals.StringTest); + +$core.addMethod( +$core.method({ +selector: "testSubStrings", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]); +return self; +}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)}); +}, +args: [], +source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).", +referencedClasses: [], +messageSends: ["assert:equals:", "subStrings:"] +}), +$globals.StringTest); + +$core.addMethod( +$core.method({ +selector: "testTrim", +protocol: 'tests', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +self._assert_equals_(" jackie"._trimLeft(),"jackie"); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((16)._sqrt(),(4)); +self._assert_equals_("jackie "._trimRight(),"jackie"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4", +source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "sqrt"] +messageSends: ["assert:equals:", "trimLeft", "trimRight"] }), -$globals.NumberTest); +$globals.StringTest); $core.addMethod( $core.method({ -selector: "testSquared", +selector: "testValue", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((4)._squared(),(16)); +self._assert_equals_("asString"._value_((1)),"1"); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16", +source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "squared"] +messageSends: ["assert:equals:", "value:", "collect:"] +}), +$globals.StringTest); + + +$core.addMethod( +$core.method({ +selector: "collectionClass", +protocol: 'fixture', +fn: function (){ +var self=this; +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $String(); + +}, +args: [], +source: "collectionClass\x0a\x09^ String", +referencedClasses: ["String"], +messageSends: [] +}), +$globals.StringTest.klass); + + +$core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests'); +$core.addMethod( +$core.method({ +selector: "collection", +protocol: 'fixture', +fn: function (){ +var self=this; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($Set())._new(); +$recv($2)._add_($Smalltalk()); +$ctx1.sendIdx["add:"]=1; +$recv($2)._add_(nil); +$ctx1.sendIdx["add:"]=2; +$recv($2)._add_((3).__at((3))); +$ctx1.sendIdx["add:"]=3; +$recv($2)._add_(false); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)}); +}, +args: [], +source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself", +referencedClasses: ["Set", "Smalltalk"], +messageSends: ["add:", "new", "@", "yourself"] +}), +$globals.SetTest); + +$core.addMethod( +$core.method({ +selector: "collectionOfPrintStrings", +protocol: 'fixture', +fn: function (){ +var self=this; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($Set())._new(); +$recv($2)._add_("a SmalltalkImage"); +$ctx1.sendIdx["add:"]=1; +$recv($2)._add_("nil"); +$ctx1.sendIdx["add:"]=2; +$recv($2)._add_("3@3"); +$ctx1.sendIdx["add:"]=3; +$recv($2)._add_("false"); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)}); +}, +args: [], +source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself", +referencedClasses: ["Set"], +messageSends: ["add:", "new", "yourself"] +}), +$globals.SetTest); + +$core.addMethod( +$core.method({ +selector: "collectionSize", +protocol: 'fixture', +fn: function (){ +var self=this; +return (4); + +}, +args: [], +source: "collectionSize\x0a\x09^ 4", +referencedClasses: [], +messageSends: [] +}), +$globals.SetTest); + +$core.addMethod( +$core.method({ +selector: "collectionWithDuplicates", +protocol: 'fixture', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=self._collection(); +$recv($2)._add_((0)); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)}); +}, +args: [], +source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself", +referencedClasses: [], +messageSends: ["add:", "collection", "yourself"] +}), +$globals.SetTest); + +$core.addMethod( +$core.method({ +selector: "collectionWithNewValue", +protocol: 'fixture', +fn: function (){ +var self=this; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} +return $core.withContext(function($ctx1) { +var $2,$3,$1; +$2=$recv($Set())._new(); +$recv($2)._add_($Smalltalk()); +$ctx1.sendIdx["add:"]=1; +$recv($2)._add_(nil); +$ctx1.sendIdx["add:"]=2; +$recv($2)._add_((3).__at((3))); +$ctx1.sendIdx["add:"]=3; +$recv($2)._add_("N"); +$ctx1.sendIdx["add:"]=4; +$recv($2)._add_(false); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)}); +}, +args: [], +source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself", +referencedClasses: ["Set", "Smalltalk"], +messageSends: ["add:", "new", "@", "yourself"] }), -$globals.NumberTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testTimesRepeat", +selector: "testAddAll", protocol: 'tests', fn: function (){ var self=this; -var i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -i=(0); -(0)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); -return i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["timesRepeat:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_(i,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13; +( +$ctx1.supercall = true, +$globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), [])); +$ctx1.supercall = false; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$3=$2; +$4=self._collection(); +$ctx1.sendIdx["collection"]=2; +$recv($3)._addAll_($4); +$ctx1.sendIdx["addAll:"]=1; +$5=$recv($2)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$1=$5; +$6=self._collection(); +$ctx1.sendIdx["collection"]=3; +self._assert_equals_($1,$6); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -(5)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -i=$recv(i).__plus((1)); -return i; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_(i,(5)); +$8=self._collection(); +$ctx1.sendIdx["collection"]=4; +$9=$8; +$10=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$recv($9)._addAll_($10); +$ctx1.sendIdx["addAll:"]=2; +$11=$recv($8)._yourself(); +$ctx1.sendIdx["yourself"]=2; +$7=$11; +$12=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=2; +self._assert_equals_($7,$12); +$ctx1.sendIdx["assert:equals:"]=2; +$14=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=3; +$recv($14)._addAll_(self._collection()); +$15=$recv($14)._yourself(); +$13=$15; +self._assert_equals_($13,self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5", +source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["timesRepeat:", "+", "assert:equals:"] +messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"] }), -$globals.NumberTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testTo", +selector: "testAddRemove", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var set; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]); +var $1,$2; +set=$recv($Set())._new(); +self._assert_($recv(set)._isEmpty()); +$ctx1.sendIdx["assert:"]=1; +$recv(set)._add_((3)); +$ctx1.sendIdx["add:"]=1; +$1=$recv(set)._includes_((3)); +$ctx1.sendIdx["includes:"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=2; +$recv(set)._add_((5)); +$2=$recv(set)._includes_((5)); +$ctx1.sendIdx["includes:"]=2; +self._assert_($2); +$recv(set)._remove_((3)); +self._deny_($recv(set)._includes_((3))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "to:"] +source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)", +referencedClasses: ["Set"], +messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"] }), -$globals.NumberTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testToBy", +selector: "testAt", protocol: 'tests', fn: function (){ var self=this; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=(0)._to_by_((6),(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["to:by:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,[(0), (2), (4), (6)]); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return (1)._to_by_((4),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv($recv($Set())._new())._at_put_((1),(2)); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error", -referencedClasses: ["Error"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "to:by:", "should:raise:"] +source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error", +referencedClasses: ["Set", "Error"], +messageSends: ["should:raise:", "at:put:", "new"] }), -$globals.NumberTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testTrigonometry", +selector: "testCollect", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((0)._cos(),(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_((0)._sin(),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((0)._tan(),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_((1)._arcCos(),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=4; -//>>excludeEnd("ctx"); -self._assert_equals_((0)._arcSin(),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=5; -//>>excludeEnd("ctx"); -self._assert_equals_((0)._arcTan(),(0)); +var $2,$1; +( +$ctx1.supercall = true, +$globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), [])); +$ctx1.supercall = false; +$2=[(5), (6), (8)]._asSet(); +$ctx1.sendIdx["asSet"]=1; +$1=$recv($2)._collect_((function(x){ +return $core.withContext(function($ctx2) { +return $recv(x).__backslash_backslash((3)); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +})); +self._assert_equals_($1,[(0), (2)]._asSet()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.", +source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"] +messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"] }), -$globals.NumberTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testTruncated", +selector: "testComma", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=(3)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9; +( +$ctx1.supercall = true, +$globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), [])); +$ctx1.supercall = false; +$2=self._collection(); +$ctx1.sendIdx["collection"]=1; +$3=self._collection(); +$ctx1.sendIdx["collection"]=2; +$1=$recv($2).__comma($3); +$ctx1.sendIdx[","]=1; +$4=self._collection(); +$ctx1.sendIdx["collection"]=3; +self._assert_equals_($1,$4); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$2=(3.212)._truncated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["truncated"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$6=self._collection(); +$ctx1.sendIdx["collection"]=4; +$7=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=1; +$5=$recv($6).__comma($7); +$ctx1.sendIdx[","]=2; +$8=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=2; +self._assert_equals_($5,$8); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_((3.51)._truncated(),(3)); +$10=self._collectionWithNewValue(); +$ctx1.sendIdx["collectionWithNewValue"]=3; +$9=$recv($10).__comma(self._collection()); +self._assert_equals_($9,self._collectionWithNewValue()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3", +source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "truncated"] +messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"] }), -$globals.NumberTest); - - +$globals.SetTest); -$core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests'); -//>>excludeStart("ide", pragmas.excludeIdeData); -$globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ -selector: "foo", -protocol: 'not yet classified', +selector: "testComparing", +protocol: 'tests', fn: function (){ var self=this; -var $1; -$1=self["@foo"]; -return $1; - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$6,$7,$5,$9,$8; +$1=[(0), (2)]._asSet(); +$ctx1.sendIdx["asSet"]=1; +$2=[(0), (2)]._asSet(); +$ctx1.sendIdx["asSet"]=2; +self._assert_equals_($1,$2); +$ctx1.sendIdx["assert:equals:"]=1; +$3=[(2), (0)]._asSet(); +$ctx1.sendIdx["asSet"]=3; +$4=[(0), (2)]._asSet(); +$ctx1.sendIdx["asSet"]=4; +self._assert_equals_($3,$4); +$6=[(0), (2), (3)]._asSet(); +$ctx1.sendIdx["asSet"]=5; +$7=[(0), (2)]._asSet(); +$ctx1.sendIdx["asSet"]=6; +$5=$recv($6).__eq($7); +$ctx1.sendIdx["="]=1; +self._deny_($5); +$ctx1.sendIdx["deny:"]=1; +$9=[(1), (2)]._asSet(); +$ctx1.sendIdx["asSet"]=7; +$8=$recv($9).__eq([(0), (2)]._asSet()); +self._deny_($8); +return self; +}, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "foo\x0a\x09^ foo", +source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "asSet", "deny:", "="] }), -$globals.ObjectMock); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "foo:", -protocol: 'not yet classified', -fn: function (anObject){ +selector: "testPrintString", +protocol: 'tests', +fn: function (){ var self=this; -self["@foo"]=anObject; +var set; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +return $core.withContext(function($ctx1) { +var $1,$2,$3,$4,$5,$6,$7,$8,$9; +set=$recv($Set())._new(); +$1=$recv(set)._printString(); +$ctx1.sendIdx["printString"]=1; +self._assert_equals_($1,"a Set ()"); +$ctx1.sendIdx["assert:equals:"]=1; +$2=set; +$recv($2)._add_((1)); +$ctx1.sendIdx["add:"]=1; +$3=$recv($2)._add_((3)); +$ctx1.sendIdx["add:"]=2; +$4=$recv(set)._printString(); +$ctx1.sendIdx["printString"]=2; +self._assert_equals_($4,"a Set (1 3)"); +$ctx1.sendIdx["assert:equals:"]=2; +$recv(set)._add_("foo"); +$ctx1.sendIdx["add:"]=3; +$5=$recv(set)._printString(); +$ctx1.sendIdx["printString"]=3; +self._assert_equals_($5,"a Set (1 3 'foo')"); +$ctx1.sendIdx["assert:equals:"]=3; +$6=set; +$recv($6)._remove_((1)); +$ctx1.sendIdx["remove:"]=1; +$7=$recv($6)._remove_((3)); +$8=$recv(set)._printString(); +$ctx1.sendIdx["printString"]=4; +self._assert_equals_($8,"a Set ('foo')"); +$ctx1.sendIdx["assert:equals:"]=4; +$recv(set)._add_((3)); +$ctx1.sendIdx["add:"]=4; +$9=$recv(set)._printString(); +$ctx1.sendIdx["printString"]=5; +self._assert_equals_($9,"a Set (3 'foo')"); +$ctx1.sendIdx["assert:equals:"]=5; +$recv(set)._add_((3)); +self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')"); return self; - +}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["anObject"], -source: "foo: anObject\x0a\x09foo := anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +args: [], +source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'", +referencedClasses: ["Set"], +messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"] }), -$globals.ObjectMock); - - +$globals.SetTest); -$core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "notDefined", +selector: "testUnboxedObjects", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -return void 0;; +var $4,$3,$2,$1; +$4="foo"._yourself(); +$ctx1.sendIdx["yourself"]=1; +$3=[$4,"foo"._yourself()]; +$2=$recv($3)._asSet(); +$1=$recv($2)._asArray(); +self._assert_equals_($1,["foo"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "notDefined\x0a\x09", +source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["assert:equals:", "asArray", "asSet", "yourself"] }), -$globals.ObjectTest); +$globals.SetTest); $core.addMethod( $core.method({ -selector: "testBasicAccess", +selector: "testUnicity", protocol: 'tests', fn: function (){ var self=this; -var o; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var set; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; -o=$recv($Object())._new(); -$recv(o)._basicAt_put_("a",(1)); -$1=$recv(o)._basicAt_("a"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +set=$recv($Set())._new(); +$recv(set)._add_((21)); +$ctx1.sendIdx["add:"]=1; +$recv(set)._add_("hello"); +$ctx1.sendIdx["add:"]=2; +$recv(set)._add_((21)); +$ctx1.sendIdx["add:"]=3; +$1=$recv(set)._size(); +$ctx1.sendIdx["size"]=1; +self._assert_equals_($1,(2)); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(o)._basicAt_("b"),nil); +$recv(set)._add_("hello"); +self._assert_equals_($recv(set)._size(),(2)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(set)._asArray(),[(21), "hello"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"] +source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')", +referencedClasses: ["Set"], +messageSends: ["new", "add:", "assert:equals:", "size", "asArray"] }), -$globals.ObjectTest); +$globals.SetTest); + $core.addMethod( $core.method({ -selector: "testBasicPerform", -protocol: 'tests', +selector: "collectionClass", +protocol: 'fixture', fn: function (){ var self=this; -var o; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -o=$recv($Object())._new(); -$recv(o)._basicAt_put_("func",(function(){ -return "hello"; +function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} +return $Set(); -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["basicAt:put:"]=1; -//>>excludeEnd("ctx"); -$recv(o)._basicAt_put_("func2",(function(a){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(a).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_($recv(o)._basicPerform_("func"),"hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"] +source: "collectionClass\x0a\x09^ Set", +referencedClasses: ["Set"], +messageSends: [] }), -$globals.ObjectTest); +$globals.SetTest.klass); + +$core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testDNU", +selector: "testShow", protocol: 'tests', fn: function (){ var self=this; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var originalTranscript; +function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} +function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +originalTranscript=$recv($Transcript())._current(); +$recv($Transcript())._register_($recv($ConsoleTranscript())._new()); +$ctx1.sendIdx["register:"]=1; +self._shouldnt_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv($Object())._new())._foo(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv($Transcript())._show_("Hello console!"); +$ctx2.sendIdx["show:"]=1; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$MessageNotUnderstood()); +}),$Error()); +$ctx1.sendIdx["shouldnt:raise:"]=1; +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($Transcript())._show_(console); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$Error()); +$recv($Transcript())._register_(originalTranscript); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood", -referencedClasses: ["Object", "MessageNotUnderstood"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "foo", "new"] +source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.", +referencedClasses: ["Transcript", "ConsoleTranscript", "Error"], +messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"] }), -$globals.ObjectTest); +$globals.ConsoleTranscriptTest); + + +$core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testEquality", -protocol: 'tests', +selector: "jsNull", +protocol: 'accessing', fn: function (){ var self=this; -var o; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3; -o=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=$recv(o).__eq($recv($Object())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -$2=$recv(o).__eq(o); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(o)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq(o); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=3; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -self._assert_($recv(o).__eq($recv(o)._yourself())); +return null; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "deny:", "=", "assert:", "yourself"] +source: "jsNull\x0a\x09", +referencedClasses: [], +messageSends: [] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testHalt", -protocol: 'tests', +selector: "jsObject", +protocol: 'accessing', fn: function (){ var self=this; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv($recv($Object())._new())._halt(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error", -referencedClasses: ["Object", "Error"], -//>>excludeEnd("ide"); -messageSends: ["should:raise:", "halt", "new"] -}), -$globals.ObjectTest); - -$core.addMethod( -$core.method({ -selector: "testIdentity", -protocol: 'tests', -fn: function (){ -var self=this; -var o; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3; -o=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=$recv(o).__eq_eq($recv($Object())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -$2=$recv(o).__eq_eq(o); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=2; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$4=$recv(o)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq_eq(o); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=3; -//>>excludeEnd("ctx"); -self._assert_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -self._assert_($recv(o).__eq_eq($recv(o)._yourself())); +args: [], +source: "jsObject\x0a\x09", +referencedClasses: [], +messageSends: [] +}), +$globals.JSObjectProxyTest); + +$core.addMethod( +$core.method({ +selector: "jsUndefined", +protocol: 'accessing', +fn: function (){ +var self=this; +return $core.withContext(function($ctx1) { +return; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "deny:", "==", "assert:", "yourself"] +source: "jsUndefined\x0a\x09", +referencedClasses: [], +messageSends: [] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testIfNil", +selector: "testAtIfAbsent", protocol: 'tests', fn: function (){ var self=this; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var testObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver; -$2=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isNil(); -self._deny_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$5=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -if(($receiver = $5) == null || $receiver.isNil){ -$4=true; -} else { -$4=$5; -}; -$3=$recv($4).__eq(true); -self._deny_($3); -$7=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -if(($receiver = $7) == null || $receiver.isNil){ -$6=$7; -} else { -$6=true; -}; -self._assert_equals_($6,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1,$2,$3; +testObject=self._jsObject(); +$1=$recv(testObject)._at_ifAbsent_("abc",(function(){ +return "Property does not exist"; + +})); +$ctx1.sendIdx["at:ifAbsent:"]=1; +self._assert_equals_($1,"Property does not exist"); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$9=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=4; -//>>excludeEnd("ctx"); -if(($receiver = $9) == null || $receiver.isNil){ -$8=false; -} else { -$8=true; -}; -self._assert_equals_($8,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$2=$recv(testObject)._at_ifAbsent_("e",(function(){ +return "Property does not exist"; + +})); +$ctx1.sendIdx["at:ifAbsent:"]=2; +self._assert_equals_($2,nil); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$11=$recv($Object())._new(); -if(($receiver = $11) == null || $receiver.isNil){ -$10=false; -} else { -$10=true; -}; -self._assert_equals_($10,true); +$3=$recv(testObject)._at_ifAbsent_("a",(function(){ +return "Property does not exist"; + +})); +$ctx1.sendIdx["at:ifAbsent:"]=3; +self._assert_equals_($3,(1)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){ +return "Property does not exist"; + +})),nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"] +source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.", +referencedClasses: [], +messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testInstVars", +selector: "testAtIfPresent", protocol: 'tests', fn: function (){ var self=this; -var o; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var testObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -o=$recv($ObjectMock())._new(); -$1=$recv(o)._instVarAt_("foo"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instVarAt:"]=1; -//>>excludeEnd("ctx"); +var $2,$1,$4,$3,$6,$5; +testObject=self._jsObject(); +$1=$recv(testObject)._at_ifPresent_("abc",(function(x){ +return $core.withContext(function($ctx2) { +$2=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=1; +return "hello ".__comma($2); +$ctx2.sendIdx[","]=1; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +})); +$ctx1.sendIdx["at:ifPresent:"]=1; self._assert_equals_($1,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(o)._instVarAt_put_("foo",(1)); -$2=$recv(o)._instVarAt_("foo"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["instVarAt:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +$3=$recv(testObject)._at_ifPresent_("e",(function(x){ +return $core.withContext(function($ctx2) { +$4=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=2; +return "hello ".__comma($4); +$ctx2.sendIdx[","]=2; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)}); +})); +$ctx1.sendIdx["at:ifPresent:"]=2; +self._assert_equals_($3,"hello nil"); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($recv(o)._instVarAt_("foo"),(1)); +$5=$recv(testObject)._at_ifPresent_("a",(function(x){ +return $core.withContext(function($ctx2) { +$6=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=3; +return "hello ".__comma($6); +$ctx2.sendIdx[","]=3; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)}); +})); +$ctx1.sendIdx["at:ifPresent:"]=3; +self._assert_equals_($5,"hello 1"); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){ +return $core.withContext(function($ctx2) { +return "hello ".__comma($recv(x)._asString()); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)}); +})),"hello nil"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1", -referencedClasses: ["ObjectMock"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"] +source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.", +referencedClasses: [], +messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testNilUndefined", +selector: "testAtIfPresentIfAbsent", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var testObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(self._notDefined(),nil); +var $2,$1,$4,$3,$6,$5; +testObject=self._jsObject(); +$1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){ +return $core.withContext(function($ctx2) { +$2=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=1; +return "hello ".__comma($2); +$ctx2.sendIdx[","]=1; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +}),(function(){ +return "not present"; + +})); +$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1; +self._assert_equals_($1,"not present"); +$ctx1.sendIdx["assert:equals:"]=1; +$3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){ +return $core.withContext(function($ctx2) { +$4=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=2; +return "hello ".__comma($4); +$ctx2.sendIdx[","]=2; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)}); +}),(function(){ +return "not present"; + +})); +$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2; +self._assert_equals_($3,"hello nil"); +$ctx1.sendIdx["assert:equals:"]=2; +$5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){ +return $core.withContext(function($ctx2) { +$6=$recv(x)._asString(); +$ctx2.sendIdx["asString"]=3; +return "hello ".__comma($6); +$ctx2.sendIdx[","]=3; +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)}); +}),(function(){ +return "not present"; + +})); +$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3; +self._assert_equals_($5,"hello 1"); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){ +return $core.withContext(function($ctx2) { +return "hello ".__comma($recv(x)._asString()); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)}); +}),(function(){ +return "not present"; + +})),"hello nil"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil", +source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "notDefined"] +messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testYourself", +selector: "testAtPut", protocol: 'tests', fn: function (){ var self=this; -var o; -function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var testObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -o=$recv($ObjectMock())._new(); -self._assert_($recv($recv(o)._yourself()).__eq_eq(o)); +var $2,$1; +testObject=self._jsObject(); +$2=$recv(testObject)._at_("abc"); +$ctx1.sendIdx["at:"]=1; +$1=$recv($2).__tild_eq("xyz"); +self._assert_($1); +self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz"); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv(testObject)._at_("abc"),"xyz"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o", -referencedClasses: ["ObjectMock"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:", "==", "yourself"] +source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'", +referencedClasses: [], +messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"] }), -$globals.ObjectTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testidentityHash", +selector: "testComparison", protocol: 'tests', fn: function (){ var self=this; -var o1,o2; function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$5,$4; -o1=$recv($Object())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -o2=$recv($Object())._new(); -$2=$recv(o1)._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=1; -//>>excludeEnd("ctx"); -$3=$recv(o1)._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq_eq($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); +var $1,$2; +self._assert_equals_($recv([console,(2)])._indexOf_(console),(1)); +$1=$recv(console).__eq(console); +$ctx1.sendIdx["="]=1; self._assert_($1); -$5=$recv(o1)._identityHash(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["identityHash"]=3; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq_eq($recv(o2)._identityHash()); -self._deny_($4); +$2=$recv(console).__eq($recv($Object())._new()); +$ctx1.sendIdx["="]=2; +self._deny_($2); +$ctx1.sendIdx["deny:"]=1; +self._deny_($recv(console).__eq(self._jsObject())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash", +source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject", referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["new", "assert:", "==", "identityHash", "deny:"] +messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"] }), -$globals.ObjectTest); - - +$globals.JSObjectProxyTest); -$core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAccessing", +selector: "testDNU", protocol: 'tests', fn: function (){ var self=this; -function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$3,$6,$5,$4; -$2=$recv($Point())._x_y_((3),(4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x:y:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$3=$recv($recv($Point())._x_y_((3),(4)))._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$6=$recv($Point())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6)._x_((3)); -$4=$recv($5)._x(); -self._assert_equals_($4,(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4)); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self._jsObject())._foo(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4", -referencedClasses: ["Point"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"] +source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["should:raise:", "foo", "jsObject"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testArithmetic", +selector: "testDNURegression1057", protocol: 'tests', fn: function (){ var self=this; -function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsObject; +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13; -$2=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$3=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__star($3); -$4=$recv($Point())._x_y_((9),(16)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x:y:"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +jsObject=[]; +$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); +$ctx1.sendIdx["basicAt:put:"]=1; +$recv(jsObject)._basicAt_put_("foo",(3)); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(jsObject)._foo(); +$ctx2.sendIdx["foo"]=1; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); +$ctx1.sendIdx["shouldnt:raise:"]=1; +$1=$recv(jsObject)._foo(); +$ctx1.sendIdx["foo"]=2; +self._assert_equals_($1,(3)); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=3; -//>>excludeEnd("ctx"); -$7=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=4; -//>>excludeEnd("ctx"); -$5=$recv($6).__plus($7); -$8=$recv($Point())._x_y_((6),(8)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x:y:"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$10=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=5; -//>>excludeEnd("ctx"); -$11=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=6; -//>>excludeEnd("ctx"); -$9=$recv($10).__minus($11); -$12=$recv($Point())._x_y_((0),(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x:y:"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($9,$12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$14=(6).__at((8)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=7; -//>>excludeEnd("ctx"); -$13=$recv($14).__slash((3).__at((4))); -self._assert_equals_($13,$recv($Point())._x_y_((2),(2))); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(jsObject)._foo_((4)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$Error()); +self._assert_equals_($recv(jsObject)._foo(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)", -referencedClasses: ["Point"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"] +source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4", +referencedClasses: ["Error"], +messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testAt", +selector: "testDNURegression1059", protocol: 'tests', fn: function (){ var self=this; -function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsObject; +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4))); +jsObject=[]; +$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); +$ctx1.sendIdx["basicAt:put:"]=1; +$recv(jsObject)._basicAt_put_("x",(3)); +$ctx1.sendIdx["basicAt:put:"]=2; +$recv(jsObject)._basicAt_put_("x:",(function(){ +return $core.withContext(function($ctx2) { +return self._error(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(jsObject)._x_((4)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$Error()); +self._assert_equals_($recv(jsObject)._x(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)", -referencedClasses: ["Point"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "@", "x:y:"] +source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4", +referencedClasses: ["Error"], +messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testComparison", +selector: "testDNURegression1062", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsObject,stored; +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22; -$2=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$3=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__lt($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["<"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$5=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=3; -//>>excludeEnd("ctx"); -$6=(4).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=4; -//>>excludeEnd("ctx"); -$4=$recv($5).__lt($6); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$8=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=5; -//>>excludeEnd("ctx"); -$9=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=6; -//>>excludeEnd("ctx"); -$7=$recv($8).__lt_eq($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["<="]=1; -//>>excludeEnd("ctx"); -self._assert_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$11=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=7; -//>>excludeEnd("ctx"); -$12=(3).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=8; -//>>excludeEnd("ctx"); -$10=$recv($11).__lt_eq($12); -self._deny_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -$14=(5).__at((6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=9; -//>>excludeEnd("ctx"); -$15=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=10; -//>>excludeEnd("ctx"); -$13=$recv($14).__gt($15); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">"]=1; -//>>excludeEnd("ctx"); -self._assert_($13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$17=(5).__at((6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=11; -//>>excludeEnd("ctx"); -$18=(6).__at((6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=12; -//>>excludeEnd("ctx"); -$16=$recv($17).__gt($18); -self._deny_($16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=3; -//>>excludeEnd("ctx"); -$20=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=13; -//>>excludeEnd("ctx"); -$21=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=14; -//>>excludeEnd("ctx"); -$19=$recv($20).__gt_eq($21); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx[">="]=1; -//>>excludeEnd("ctx"); -self._assert_($19); -$23=(4).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=15; -//>>excludeEnd("ctx"); -$22=$recv($23).__gt_eq((5).__at((5))); -self._deny_($22); +jsObject=[]; +$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); +$ctx1.sendIdx["basicAt:put:"]=1; +$recv(jsObject)._basicAt_put_("x",(function(v){ +stored=v; +return stored; + +})); +self._shouldnt_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(jsObject)._x_((4)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$Error()); +self._assert_equals_(stored,(4)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)}); +}, +args: [], +source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4", +referencedClasses: ["Error"], +messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"] +}), +$globals.JSObjectProxyTest); + +$core.addMethod( +$core.method({ +selector: "testDNUWithAllowJavaScriptCalls", +protocol: 'tests', +fn: function (){ +var self=this; +var jsObject; +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} +return $core.withContext(function($ctx1) { +jsObject=[]; +$recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(jsObject)._foo(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="] +source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["basicAt:put:", "should:raise:", "foo"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testEgality", +selector: "testMessageSend", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$5,$4; -$2=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$3=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -$5=(3).__at((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=3; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq((3).__at((6))); -self._deny_($4); +var $2,$1,$4,$3; +$2=self._jsObject(); +$ctx1.sendIdx["jsObject"]=1; +$1=$recv($2)._a(); +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$4=self._jsObject(); +$ctx1.sendIdx["jsObject"]=2; +$3=$recv($4)._b(); +self._assert_equals_($3,(2)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(self._jsObject())._c_((3)),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)", +source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "=", "@", "deny:"] +messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testNew", +selector: "testMethodWithArguments", protocol: 'tests', fn: function (){ var self=this; -function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8; -$3=$recv($Point())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._x_((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._y(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["y"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$7=$recv($Point())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._x_((3)); -$5=$recv($6)._x(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["x"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5).__eq((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$10=$recv($Point())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10)._y_((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["y:"]=1; -//>>excludeEnd("ctx"); -$8=$recv($9)._x(); -self._assert_equals_($8,nil); -self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0))); +self._assert_equals_($recv(self._jsObject())._c_((1)),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0", -referencedClasses: ["Point"], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"] +source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1", +referencedClasses: [], +messageSends: ["assert:equals:", "c:", "jsObject"] }), -$globals.PointTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testTranslateBy", +selector: "testPrinting", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14; -$2=(3).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$3=(0).__at((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$1=$recv($2)._translateBy_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["translateBy:"]=1; -//>>excludeEnd("ctx"); -$4=(3).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$6=(3).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=4; -//>>excludeEnd("ctx"); -$8=(1)._negated(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["negated"]=1; -//>>excludeEnd("ctx"); -$7=(0).__at($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=5; -//>>excludeEnd("ctx"); -$5=$recv($6)._translateBy_($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["translateBy:"]=2; -//>>excludeEnd("ctx"); -$9=(3).__at((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=6; -//>>excludeEnd("ctx"); -self._assert_equals_($5,$9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$11=(3).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=7; -//>>excludeEnd("ctx"); -$12=(2).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=8; -//>>excludeEnd("ctx"); -$10=$recv($11)._translateBy_($12); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["translateBy:"]=3; -//>>excludeEnd("ctx"); -$13=(5).__at((6)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=9; -//>>excludeEnd("ctx"); -self._assert_equals_($10,$13); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$15=(3).__at((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=10; -//>>excludeEnd("ctx"); -$16=$recv((3)._negated()).__at((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=11; -//>>excludeEnd("ctx"); -$14=$recv($15)._translateBy_($16); -self._assert_equals_($14,(0).__at((3))); +self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.", +source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "translateBy:", "@", "negated"] +messageSends: ["assert:equals:", "printString", "jsObject"] }), -$globals.PointTest); - - +$globals.JSObjectProxyTest); -$core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testNextIfAbsent", +selector: "testPropertyThatReturnsEmptyString", protocol: 'tests', fn: function (){ var self=this; -var queue; -function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var object; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -queue=$recv($Queue())._new(); -$recv(queue)._nextPut_("index1"); -$2=$recv(queue)._nextIfAbsent_("empty"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextIfAbsent:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq("index1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1")); +var $1; +object=self._jsObject(); +$1=$recv(object)._d(); +$ctx1.sendIdx["d"]=1; +self._assert_equals_($1,""); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(object)._d_("hello"); +self._assert_equals_($recv(object)._d(),"hello"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'", -referencedClasses: ["Queue"], -//>>excludeEnd("ide"); -messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"] +source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'", +referencedClasses: [], +messageSends: ["jsObject", "assert:equals:", "d", "d:"] }), -$globals.QueueTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testQueueNext", +selector: "testPropertyThatReturnsUndefined", protocol: 'tests', fn: function (){ var self=this; -var queue; -function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)} -function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var object; +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$3,$6,$5; -queue=$recv($Queue())._new(); -$1=queue; -$recv($1)._nextPut_("index1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nextPut:"]=1; -//>>excludeEnd("ctx"); -$2=$recv($1)._nextPut_("index2"); -$4=$recv(queue)._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["next"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4).__eq("index1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._assert_($3); -$6=$recv(queue)._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["next"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6).__eq("index"); -self._deny_($5); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +object=self._jsObject(); +self._shouldnt_raise_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(queue)._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +return $recv(object)._e(); +$ctx2.sendIdx["e"]=1; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$Error()); +}),$MessageNotUnderstood()); +self._assert_($recv($recv(object)._e())._isNil()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error", -referencedClasses: ["Queue", "Error"], -//>>excludeEnd("ide"); -messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"] +source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"] }), -$globals.QueueTest); - - +$globals.JSObjectProxyTest); -$core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAtRandomNumber", +selector: "testSetPropertyWithFalsyValue", protocol: 'tests', fn: function (){ var self=this; -var val; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var jsObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -(100)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -val=(10)._atRandom(); -val; -self._assert_($recv(val).__gt((0))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -return self._assert_($recv(val).__lt((11))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1,$2,$3,$4,$5; +jsObject=self._jsObject(); +$1=$recv(jsObject)._a(); +$ctx1.sendIdx["a"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(jsObject)._a_(self._jsNull()); +$ctx1.sendIdx["a:"]=1; +$2=$recv(jsObject)._a(); +$ctx1.sendIdx["a"]=2; +self._assert_equals_($2,nil); +$ctx1.sendIdx["assert:equals:"]=2; +$recv(jsObject)._a_((0)); +$ctx1.sendIdx["a:"]=2; +$3=$recv(jsObject)._a(); +$ctx1.sendIdx["a"]=3; +self._assert_equals_($3,(0)); +$ctx1.sendIdx["assert:equals:"]=3; +$recv(jsObject)._a_(self._jsUndefined()); +$ctx1.sendIdx["a:"]=3; +$4=$recv(jsObject)._a(); +$ctx1.sendIdx["a"]=4; +self._assert_equals_($4,nil); +$ctx1.sendIdx["assert:equals:"]=4; +$recv(jsObject)._a_(""); +$ctx1.sendIdx["a:"]=4; +$5=$recv(jsObject)._a(); +$ctx1.sendIdx["a"]=5; +self._assert_equals_($5,""); +$ctx1.sendIdx["assert:equals:"]=5; +$recv(jsObject)._a_(false); +self._assert_equals_($recv(jsObject)._a(),false); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]", +source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"] +messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"] }), -$globals.RandomTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "testAtRandomSequenceableCollection", +selector: "testValue", protocol: 'tests', fn: function (){ var self=this; -var val; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var testObject; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$4,$2,$1; -(100)._timesRepeat_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -val="abc"._atRandom(); -val; -$3=$recv(val).__eq("a"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -$4=$recv(val).__eq("b"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=2; -//>>excludeEnd("ctx"); -$2=$recv($3).__or($4); -$1=$recv($2).__or($recv(val).__eq("c")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["|"]=1; -//>>excludeEnd("ctx"); -return self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +testObject=self._jsObject(); +$recv(testObject)._at_put_("value","aValue"); +self._assert_equals_($recv(testObject)._value(),"aValue"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].", +source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="] +messageSends: ["jsObject", "at:put:", "assert:equals:", "value"] }), -$globals.RandomTest); +$globals.JSObjectProxyTest); $core.addMethod( $core.method({ -selector: "textNext", +selector: "testYourself", protocol: 'tests', fn: function (){ var self=this; -function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var object; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -(10000)._timesRepeat_((function(){ -var current,next; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -next=$recv($recv($Random())._new())._next(); -next; -self._assert_($recv(next).__gt_eq((0))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -self._assert_($recv(next).__lt((1))); -$1=$recv(current).__eq(next); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($1); -return $recv(next).__eq(current); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); +var $1,$2; +$1=self._jsObject(); +$recv($1)._d_("test"); +$2=$recv($1)._yourself(); +object=$2; +self._assert_equals_($recv(object)._d(),"test"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]", -referencedClasses: ["Random"], -//>>excludeEnd("ide"); -messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="] +source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'", +referencedClasses: [], +messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"] }), -$globals.RandomTest); +$globals.JSObjectProxyTest); -$core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests'); +$core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'accessing', +selector: "testCatchingException", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._class())._collectionClass(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._throwException(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(error){ +return $core.withContext(function($ctx2) { +return self._assert_($recv($recv(error)._exception()).__eq("test")); +}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ self class collectionClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["collectionClass", "class"] +source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]", +referencedClasses: ["Error"], +messageSends: ["on:do:", "throwException", "assert:", "=", "exception"] }), -$globals.StreamTest); +$globals.JavaScriptExceptionTest); $core.addMethod( $core.method({ -selector: "newCollection", -protocol: 'accessing', +selector: "testRaisingException", +protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._collectionClass())._new(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return self._throwException(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$JavaScriptException()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newCollection\x0a\x09^ self collectionClass new", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["new", "collectionClass"] +source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException", +referencedClasses: ["JavaScriptException"], +messageSends: ["should:raise:", "throwException"] }), -$globals.StreamTest); +$globals.JavaScriptExceptionTest); $core.addMethod( $core.method({ -selector: "newStream", -protocol: 'accessing', +selector: "throwException", +protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($recv(self._collectionClass())._new())._stream(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +throw 'test'; +return self; +}, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newStream\x0a\x09^ self collectionClass new stream", +source: "throwException\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["stream", "new", "collectionClass"] +messageSends: [] }), -$globals.StreamTest); +$globals.JavaScriptExceptionTest); + + +$core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testAtStartAtEnd", +selector: "testValue", protocol: 'tests', fn: function (){ var self=this; -var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var messageSend; +function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)} +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -stream=self._newStream(); -$1=$recv(stream)._atStart(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["atStart"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$2=$recv(stream)._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["atEnd"]=1; -//>>excludeEnd("ctx"); -self._assert_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$recv(stream)._nextPutAll_(self._newCollection()); -$3=$recv(stream)._atEnd(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["atEnd"]=2; -//>>excludeEnd("ctx"); -self._assert_($3); -$4=$recv(stream)._atStart(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["atStart"]=2; -//>>excludeEnd("ctx"); -self._deny_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -$recv(stream)._position_((1)); -self._deny_($recv(stream)._atEnd()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=2; -//>>excludeEnd("ctx"); -self._deny_($recv(stream)._atStart()); +var $1,$2; +$1=$recv($MessageSend())._new(); +$ctx1.sendIdx["new"]=1; +$recv($1)._receiver_($recv($Object())._new()); +$recv($1)._selector_("asString"); +$2=$recv($1)._yourself(); +messageSend=$2; +self._assert_equals_($recv(messageSend)._value(),"an Object"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"] +source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'", +referencedClasses: ["MessageSend", "Object"], +messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"] }), -$globals.StreamTest); +$globals.MessageSendTest); $core.addMethod( $core.method({ -selector: "testContents", +selector: "testValueWithArguments", protocol: 'tests', fn: function (){ var self=this; -var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var messageSend; +function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; -stream=self._newStream(); -$1=stream; -$2=self._newCollection(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["newCollection"]=1; -//>>excludeEnd("ctx"); -$recv($1)._nextPutAll_($2); -self._assert_equals_($recv(stream)._contents(),self._newCollection()); +$1=$recv($MessageSend())._new(); +$recv($1)._receiver_((2)); +$recv($1)._selector_("+"); +$2=$recv($1)._yourself(); +messageSend=$2; +self._assert_equals_($recv(messageSend)._value_((3)),(5)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"] +source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6", +referencedClasses: ["MessageSend"], +messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"] +}), +$globals.MessageSendTest); + + + +$core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests'); +$core.addMethod( +$core.method({ +selector: "codeGeneratorClass", +protocol: 'accessing', +fn: function (){ +var self=this; +function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)} +return $CodeGenerator(); + +}, +args: [], +source: "codeGeneratorClass\x0a\x09^ CodeGenerator", +referencedClasses: ["CodeGenerator"], +messageSends: [] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testIsEmpty", -protocol: 'tests', +selector: "compiler", +protocol: 'factory', fn: function (){ var self=this; -var stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -stream=self._newStream(); -$1=$recv(stream)._isEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isEmpty"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -$recv(stream)._nextPutAll_(self._newCollection()); -self._deny_($recv(stream)._isEmpty()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +var $2,$3,$1; +$2=$recv($Compiler())._new(); +$recv($2)._codeGeneratorClass_(self._codeGeneratorClass()); +$3=$recv($2)._yourself(); +$1=$3; +return $1; +}, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"] +source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself", +referencedClasses: ["Compiler"], +messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testPosition", -protocol: 'tests', +selector: "deinstallBottom", +protocol: 'testing', fn: function (){ var self=this; -var collection,stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -collection=self._newCollection(); -stream=self._newStream(); -$recv(stream)._nextPutAll_(collection); -$1=$recv(stream)._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["position"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,$recv(collection)._size()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$recv(stream)._position_((0)); -$2=$recv(stream)._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["position"]=2; -//>>excludeEnd("ctx"); -self._assert_equals_($2,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -$recv(stream)._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["next"]=1; -//>>excludeEnd("ctx"); -$3=$recv(stream)._position(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["position"]=3; -//>>excludeEnd("ctx"); -self._assert_equals_($3,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=3; -//>>excludeEnd("ctx"); -$recv(stream)._next(); -self._assert_equals_($recv(stream)._position(),(2)); +$recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2", +source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"] +messageSends: ["removeCompiledMethod:", "targetClassBottom"] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testReading", -protocol: 'tests', +selector: "deinstallMiddle", +protocol: 'testing', fn: function (){ var self=this; -var stream,collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3; -collection=self._newCollection(); -stream=self._newStream(); -$1=stream; -$recv($1)._nextPutAll_(collection); -$2=$recv($1)._position_((0)); -$recv(collection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$3=$recv(stream)._next(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["next"]=1; -//>>excludeEnd("ctx"); -return self._assert_equals_($3,each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._assert_($recv($recv(stream)._next())._isNil()); +$recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil", +source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"] +messageSends: ["removeCompiledMethod:", "targetClassMiddle"] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testStreamContents", -protocol: 'tests', +selector: "deinstallTop", +protocol: 'testing', fn: function (){ var self=this; +return $core.withContext(function($ctx1) { +$recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]); return self; - +}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testStreamContents", +source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["removeCompiledMethod:", "targetClassTop"] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testWrite", -protocol: 'tests', -fn: function (){ +selector: "installBottom:", +protocol: 'testing', +fn: function (aString){ var self=this; -var stream,collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -collection=self._newCollection(); -stream=self._newStream(); -$recv(collection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(stream).__lt_lt(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -self._assert_equals_($recv(stream)._contents(),collection); +self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection", +args: ["aString"], +source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"] +messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"] }), -$globals.StreamTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testWriting", -protocol: 'tests', -fn: function (){ +selector: "installMiddle:", +protocol: 'testing', +fn: function (aString){ var self=this; -var stream,collection; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -collection=self._newCollection(); -stream=self._newStream(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["newStream"]=1; -//>>excludeEnd("ctx"); -$recv(collection)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(stream)._nextPut_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -$1=$recv(stream)._contents(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["contents"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,collection); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -stream=self._newStream(); -$recv(stream)._nextPutAll_(collection); -self._assert_equals_($recv(stream)._contents(),collection); +self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection", +args: ["aString"], +source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"] +messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"] }), -$globals.StreamTest); - +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'accessing', -fn: function (){ +selector: "installTop:", +protocol: 'testing', +fn: function (aString){ var self=this; -return nil; - +return $core.withContext(function($ctx1) { +self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests"); +return self; +}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "collectionClass\x0a\x09^ nil", +args: ["aString"], +source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"] }), -$globals.StreamTest.klass); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "isAbstract", -protocol: 'testing', +selector: "setUp", +protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv(self._collectionClass())._isNil(); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)}); -//>>excludeEnd("ctx"); +self["@receiverTop"]=$recv(self._targetClassTop())._new(); +$ctx1.sendIdx["new"]=1; +self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new(); +$ctx1.sendIdx["new"]=2; +self["@receiverBottom"]=$recv(self._targetClassBottom())._new(); +self["@method"]=nil; +self["@performBlock"]=(function(){ +return $core.withContext(function($ctx2) { +return self._error_("performBlock not initialized"); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}); +return self; +}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "isAbstract\x0a\x09^ self collectionClass isNil", +source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["isNil", "collectionClass"] +messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"] }), -$globals.StreamTest.klass); - +$globals.MethodInheritanceTest); -$core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "newCollection", -protocol: 'accessing', +selector: "shouldMNU", +protocol: 'testing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=[true,(1),(3).__at((4)),"foo"]; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)}); -//>>excludeEnd("ctx"); +self._shouldMNUTop(); +self._shouldMNUMiddle(); +self._shouldMNUBottom(); +return self; +}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }", +source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["@"] +messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"] }), -$globals.ArrayStreamTest); - +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'accessing', +selector: "shouldMNUBottom", +protocol: 'testing', fn: function (){ var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -return $Array(); - +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} +return $core.withContext(function($ctx1) { +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@performBlock"])._value_(self["@receiverBottom"]); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); +return self; +}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ Array", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: [] +source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["should:raise:", "value:"] }), -$globals.ArrayStreamTest.klass); - +$globals.MethodInheritanceTest); -$core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "newCollection", -protocol: 'accessing', +selector: "shouldMNUMiddle", +protocol: 'testing', fn: function (){ var self=this; -return "hello world"; - +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} +return $core.withContext(function($ctx1) { +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); +return self; +}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "newCollection\x0a\x09^ 'hello world'", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["should:raise:", "value:"] }), -$globals.StringStreamTest); - +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "collectionClass", -protocol: 'accessing', +selector: "shouldMNUTop", +protocol: 'testing', fn: function (){ var self=this; -function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -return $String(); - +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} +return $core.withContext(function($ctx1) { +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(self["@performBlock"])._value_(self["@receiverTop"]); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); +return self; +}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "collectionClass\x0a\x09^ String", -referencedClasses: ["String"], -//>>excludeEnd("ide"); -messageSends: [] +source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["should:raise:", "value:"] }), -$globals.StringStreamTest.klass); - +$globals.MethodInheritanceTest); -$core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testCopying", -protocol: 'tests', -fn: function (){ +selector: "shouldReturn:", +protocol: 'testing', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var result; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_equals_(nil._copy(),nil); +result=$recv(self["@performBlock"])._value_(self["@receiverTop"]); +$ctx1.sendIdx["value:"]=1; +self._assert_equals_(["top",anObject],["top",result]); +$ctx1.sendIdx["assert:equals:"]=1; +result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]); +$ctx1.sendIdx["value:"]=2; +self._assert_equals_(["middle",anObject],["middle",result]); +$ctx1.sendIdx["assert:equals:"]=2; +result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]); +self._assert_equals_(["bottom",anObject],["bottom",result]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testCopying\x0a\x09self assert: nil copy equals: nil", +args: ["anObject"], +source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "copy"] +messageSends: ["value:", "assert:equals:"] }), -$globals.UndefinedTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testDeepCopy", -protocol: 'tests', -fn: function (){ +selector: "shouldReturn:and:and:", +protocol: 'testing', +fn: function (anObject,anObject2,anObject3){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var result; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_($recv(nil._deepCopy()).__eq(nil)); +result=$recv(self["@performBlock"])._value_(self["@receiverTop"]); +$ctx1.sendIdx["value:"]=1; +self._assert_equals_(["top",anObject],["top",result]); +$ctx1.sendIdx["assert:equals:"]=1; +result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]); +$ctx1.sendIdx["value:"]=2; +self._assert_equals_(["middle",anObject2],["middle",result]); +$ctx1.sendIdx["assert:equals:"]=2; +result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]); +self._assert_equals_(["bottom",anObject3],["bottom",result]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil", +args: ["anObject", "anObject2", "anObject3"], +source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "=", "deepCopy"] +messageSends: ["value:", "assert:equals:"] }), -$globals.UndefinedTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testIfNil", -protocol: 'tests', +selector: "targetClassBottom", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$3,$2,$4,$6,$5,$receiver; -if(($receiver = nil) == null || $receiver.isNil){ -$1=true; -} else { -$1=nil; -}; -self._assert_equals_($1,true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -if(($receiver = nil) == null || $receiver.isNil){ -$3=nil; -} else { -$3=true; -}; -$2=$recv($3).__eq(true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); -self._deny_($2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); -if(($receiver = nil) == null || $receiver.isNil){ -$4=true; -} else { -$4=false; -}; -self._assert_equals_($4,true); -if(($receiver = nil) == null || $receiver.isNil){ -$6=false; -} else { -$6=true; -}; -$5=$recv($6).__eq(true); -self._deny_($5); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)}); -//>>excludeEnd("ctx"); +function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} +return $JavaScriptException(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"] +source: "targetClassBottom\x0a\x09^ JavaScriptException", +referencedClasses: ["JavaScriptException"], +messageSends: [] }), -$globals.UndefinedTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testIsNil", -protocol: 'tests', +selector: "targetClassMiddle", +protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._assert_(nil._isNil()); -self._deny_(nil._notNil()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)}); -//>>excludeEnd("ctx"); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} +return $Error(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:", "isNil", "deny:", "notNil"] +source: "targetClassMiddle\x0a\x09^ Error", +referencedClasses: ["Error"], +messageSends: [] }), -$globals.UndefinedTest); - - -}); - -define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){ -var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; -$core.addPackage('Compiler-Tests'); -$core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); }; -$core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"}; +$globals.MethodInheritanceTest); -$core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "analyze:forClass:", -protocol: 'convenience', -fn: function (aNode,aClass){ +selector: "targetClassTop", +protocol: 'accessing', +fn: function (){ var self=this; -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode); -return aNode; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)}); -//>>excludeEnd("ctx"); +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +return $Object(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode", "aClass"], -source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode", -referencedClasses: ["SemanticAnalyzer"], -//>>excludeEnd("ide"); -messageSends: ["visit:", "on:"] +args: [], +source: "targetClassTop\x0a\x09^ Object", +referencedClasses: ["Object"], +messageSends: [] }), -$globals.ASTParsingTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "parse:", -protocol: 'parsing', -fn: function (aString){ +selector: "tearDown", +protocol: 'initialization', +fn: function (){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._parse_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "parse: aString\x0a\x09^ Smalltalk parse: aString", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:"] -}), -$globals.ASTParsingTest); +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._deinstallTop(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}))._on_do_($Error(),(function(){ + +})); +$ctx1.sendIdx["on:do:"]=1; +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._deinstallMiddle(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +}))._on_do_($Error(),(function(){ + +})); +$ctx1.sendIdx["on:do:"]=2; +$recv((function(){ +return $core.withContext(function($ctx2) { +return self._deinstallBottom(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); +}))._on_do_($Error(),(function(){ -$core.addMethod( -$core.method({ -selector: "parse:forClass:", -protocol: 'parsing', -fn: function (aString,aClass){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._analyze_forClass_(self._parse_(aString),aClass); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)}); -//>>excludeEnd("ctx"); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aClass"], -source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["analyze:forClass:", "parse:"] +args: [], +source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]", +referencedClasses: ["Error"], +messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"] }), -$globals.ASTParsingTest); - - +$globals.MethodInheritanceTest); -$core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "astPCNodeVisitor", -protocol: 'factory', +selector: "testMNU11", +protocol: 'tests', fn: function (){ var self=this; -function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} -function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1; -$2=$recv($ASTPCNodeVisitor())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$3=$2; -$4=$recv($recv($AIContext())._new())._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$recv($3)._context_($4); -$5=$recv($2)._yourself(); -$1=$5; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +self["@performBlock"]=(function(x){ +return $core.withContext(function($ctx2) { +return $recv(x)._foo(); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +}); +self._shouldMNU(); +$ctx1.sendIdx["shouldMNU"]=1; +self._installTop_("foo ^ false"); +$ctx1.sendIdx["installTop:"]=1; +self._installTop_("foo ^ true"); +self._deinstallTop(); +self._shouldMNU(); +return self; +}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", -referencedClasses: ["ASTPCNodeVisitor", "AIContext"], -//>>excludeEnd("ide"); -messageSends: ["context:", "new", "yourself"] +source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU", +referencedClasses: [], +messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"] }), -$globals.ASTPCNodeVisitorTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "astPCNodeVisitorForSelector:", -protocol: 'factory', -fn: function (aString){ +selector: "testMNU22", +protocol: 'tests', +fn: function (){ var self=this; -function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)} -function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$4,$5,$1; -$2=$recv($ASTPCNodeVisitor())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($2)._selector_(aString); -$3=$2; -$4=$recv($recv($AIContext())._new())._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$recv($3)._context_($4); -$5=$recv($2)._yourself(); -$1=$5; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +self["@performBlock"]=(function(x){ +return $core.withContext(function($ctx2) { +return $recv(x)._foo(); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +}); +self._shouldMNU(); +$ctx1.sendIdx["shouldMNU"]=1; +self._installMiddle_("foo ^ false"); +$ctx1.sendIdx["installMiddle:"]=1; +self._installMiddle_("foo ^ true"); +self._deinstallMiddle(); +self._shouldMNU(); +return self; +}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", -referencedClasses: ["ASTPCNodeVisitor", "AIContext"], -//>>excludeEnd("ide"); -messageSends: ["selector:", "new", "context:", "yourself"] +args: [], +source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU", +referencedClasses: [], +messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"] }), -$globals.ASTPCNodeVisitorTest); +$globals.MethodInheritanceTest); $core.addMethod( $core.method({ -selector: "testJSStatementNode", +selector: "testReturns1", protocol: 'tests', fn: function (){ var self=this; -var ast,visitor; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -ast=self._parse_forClass_("foo ",$Object()); -$1=self._astPCNodeVisitor(); -$recv($1)._visit_(ast); -$2=$recv($1)._currentNode(); -self._assert_($recv($2)._isJSStatementNode()); +self["@performBlock"]=(function(x){ +return $core.withContext(function($ctx2) { +return $recv(x)._foo(); +}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)}); +}); +self._installTop_("foo ^ false"); +$ctx1.sendIdx["installTop:"]=1; +self._shouldReturn_(false); +$ctx1.sendIdx["shouldReturn:"]=1; +self._installTop_("foo ^ true"); +self._shouldReturn_(true); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo ' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"] +source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true", +referencedClasses: [], +messageSends: ["foo", "installTop:", "shouldReturn:"] }), -$globals.ASTPCNodeVisitorTest); +$globals.MethodInheritanceTest); + + +$core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testMessageSend", +selector: "testAbs", protocol: 'tests', fn: function (){ var self=this; -var ast; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object()); -$1=self._astPCNodeVisitorForSelector_("yourself"); -$recv($1)._visit_(ast); -$2=$recv($1)._currentNode(); -self._assert_equals_($recv($2)._selector(),"yourself"); +var $1; +$1=(4)._abs(); +$ctx1.sendIdx["abs"]=1; +self._assert_equals_($1,(4)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((-4)._abs(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] +source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4", +referencedClasses: [], +messageSends: ["assert:equals:", "abs"] }), -$globals.ASTPCNodeVisitorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testMessageSendWithBlocks", +selector: "testArithmetic", protocol: 'tests', fn: function (){ var self=this; -var ast; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object()); -$1=self._astPCNodeVisitorForSelector_("yourself"); -$recv($1)._visit_(ast); -$2=$recv($1)._currentNode(); -self._assert_equals_($recv($2)._selector(),"yourself"); +var $1,$2,$3,$5,$4; +$1=(1.5).__plus((1)); +$ctx1.sendIdx["+"]=1; +self._assert_equals_($1,(2.5)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(2).__minus((1)); +$ctx1.sendIdx["-"]=1; +self._assert_equals_($2,(1)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((-2).__minus((1)),(-3)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_((12).__slash((2)),(6)); +$ctx1.sendIdx["assert:equals:"]=4; +$3=(3).__star((4)); +$ctx1.sendIdx["*"]=1; +self._assert_equals_($3,(12)); +$ctx1.sendIdx["assert:equals:"]=5; +self._assert_equals_((7).__slash_slash((2)),(3)); +$ctx1.sendIdx["assert:equals:"]=6; +self._assert_equals_((7).__backslash_backslash((2)),(1)); +$ctx1.sendIdx["assert:equals:"]=7; +$5=(1).__plus((2)); +$ctx1.sendIdx["+"]=2; +$4=$recv($5).__star((3)); +$ctx1.sendIdx["*"]=2; +self._assert_equals_($4,(9)); +$ctx1.sendIdx["assert:equals:"]=8; +self._assert_equals_((1).__plus((2).__star((3))),(7)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] +source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7", +referencedClasses: [], +messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"] }), -$globals.ASTPCNodeVisitorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testMessageSendWithInlining", +selector: "testAsNumber", protocol: 'tests', fn: function (){ var self=this; -var ast; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$4,$2,$1,$5,$6; -ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["parse:forClass:"]=1; -//>>excludeEnd("ctx"); -$3=self._astPCNodeVisitorForSelector_("yourself"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1; -//>>excludeEnd("ctx"); -$recv($3)._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["visit:"]=1; -//>>excludeEnd("ctx"); -$4=$recv($3)._currentNode(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["currentNode"]=1; -//>>excludeEnd("ctx"); -$2=$4; -$1=$recv($2)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,"yourself"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object()); -$5=self._astPCNodeVisitorForSelector_("asBoolean"); -$recv($5)._visit_(ast); -$6=$recv($5)._currentNode(); -self._assert_equals_($recv($6)._selector(),"asBoolean"); +self._assert_equals_((3)._asNumber(),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"] +source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.", +referencedClasses: [], +messageSends: ["assert:equals:", "asNumber"] }), -$globals.ASTPCNodeVisitorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testNoMessageSend", +selector: "testCeiling", protocol: 'tests', fn: function (){ var self=this; -var ast; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; -ast=self._parse_forClass_("foo ^ self",$Object()); -$1=self._astPCNodeVisitor(); -$recv($1)._visit_(ast); -$2=$recv($1)._currentNode(); -self._assert_($recv($2)._isNil()); +$1=(1.2)._ceiling(); +$ctx1.sendIdx["ceiling"]=1; +self._assert_equals_($1,(2)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(-1.2)._ceiling(); +$ctx1.sendIdx["ceiling"]=2; +self._assert_equals_($2,(-1)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((1)._ceiling(),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"] +source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.", +referencedClasses: [], +messageSends: ["assert:equals:", "ceiling"] }), -$globals.ASTPCNodeVisitorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testPC", +selector: "testComparison", protocol: 'tests', fn: function (){ var self=this; -var ast,visitor; -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -ast=self._parse_forClass_("foo ",$Object()); -$1=self._astPCNodeVisitor(); -$recv($1)._visit_(ast); -$2=$recv($1)._currentNode(); -self._assert_($recv($2)._isJSStatementNode()); +var $1,$2,$3,$4; +$1=(3).__gt((2)); +$ctx1.sendIdx[">"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=(2).__lt((3)); +$ctx1.sendIdx["<"]=1; +self._assert_($2); +$ctx1.sendIdx["assert:"]=2; +self._deny_((3).__lt((2))); +$ctx1.sendIdx["deny:"]=1; +self._deny_((2).__gt((3))); +$3=(3).__gt_eq((3)); +$ctx1.sendIdx[">="]=1; +self._assert_($3); +$ctx1.sendIdx["assert:"]=3; +self._assert_((3.1).__gt_eq((3))); +$ctx1.sendIdx["assert:"]=4; +$4=(3).__lt_eq((3)); +$ctx1.sendIdx["<="]=1; +self._assert_($4); +$ctx1.sendIdx["assert:"]=5; +self._assert_((3).__lt_eq((3.1))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo ' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode", -referencedClasses: ["Object"], -//>>excludeEnd("ide"); -messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"] +source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1", +referencedClasses: [], +messageSends: ["assert:", ">", "<", "deny:", ">=", "<="] }), -$globals.ASTPCNodeVisitorTest); - - +$globals.NumberTest); -$core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testNodeAtPosition", +selector: "testCopying", protocol: 'tests', fn: function (){ var self=this; -var node; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $3,$4,$2,$1,$7,$8,$6,$5; -node=self._parse_("yourself\x0a\x09^ self"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["parse:"]=1; -//>>excludeEnd("ctx"); -$3=node; -$4=(2).__at((4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){ -return nil; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._source(); -self._assert_equals_($1,"self"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["parse:"]=2; -//>>excludeEnd("ctx"); -$7=node; -$8=(2).__at((7)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["@"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){ -return nil; - -})); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["selector"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($5,"ifTrue:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); -node=self._parse_("foo\x0a\x09self foo; bar; baz"); -self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){ -return nil; - -})))._selector(),"foo"); +var $1; +$1=$recv((1)._copy()).__eq_eq((1)); +$ctx1.sendIdx["=="]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +self._assert_($recv((1)._deepCopy()).__eq_eq((1))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'", +source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"] +messageSends: ["assert:", "==", "copy", "deepCopy"] }), -$globals.ASTPositionTest); - - +$globals.NumberTest); -$core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "codeGeneratorClass", -protocol: 'accessing', +selector: "testEquality", +protocol: 'tests', fn: function (){ var self=this; -function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)} -return $CodeGenerator(); - +return $core.withContext(function($ctx1) { +var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12; +$1=(1).__eq((1)); +$ctx1.sendIdx["="]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=(0).__eq((0)); +$ctx1.sendIdx["="]=2; +self._assert_($2); +$ctx1.sendIdx["assert:"]=2; +$3=(1).__eq((0)); +$ctx1.sendIdx["="]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=1; +$5=(1)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$4=$recv($5).__eq((1)); +$ctx1.sendIdx["="]=4; +self._assert_($4); +$ctx1.sendIdx["assert:"]=3; +$7=(1)._yourself(); +$ctx1.sendIdx["yourself"]=2; +$6=(1).__eq($7); +$ctx1.sendIdx["="]=5; +self._assert_($6); +$ctx1.sendIdx["assert:"]=4; +$9=(1)._yourself(); +$ctx1.sendIdx["yourself"]=3; +$8=$recv($9).__eq((1)._yourself()); +$ctx1.sendIdx["="]=6; +self._assert_($8); +$10=(0).__eq(false); +$ctx1.sendIdx["="]=7; +self._deny_($10); +$ctx1.sendIdx["deny:"]=2; +$11=false.__eq((0)); +$ctx1.sendIdx["="]=8; +self._deny_($11); +$ctx1.sendIdx["deny:"]=3; +$12="".__eq((0)); +$ctx1.sendIdx["="]=9; +self._deny_($12); +$ctx1.sendIdx["deny:"]=4; +self._deny_((0).__eq("")); +return self; +}, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "codeGeneratorClass\x0a\x09^ CodeGenerator", -referencedClasses: ["CodeGenerator"], -//>>excludeEnd("ide"); -messageSends: [] +source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''", +referencedClasses: [], +messageSends: ["assert:", "=", "deny:", "yourself"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "compiler", -protocol: 'factory', +selector: "testFloor", +protocol: 'tests', fn: function (){ var self=this; -function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1; -$2=$recv($Compiler())._new(); -$recv($2)._codeGeneratorClass_(self._codeGeneratorClass()); -$3=$recv($2)._yourself(); -$1=$3; -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +var $1,$2; +$1=(1.2)._floor(); +$ctx1.sendIdx["floor"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(-1.2)._floor(); +$ctx1.sendIdx["floor"]=2; +self._assert_equals_($2,(-2)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((1)._floor(),(1)); +return self; +}, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself", -referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); -messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"] +source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.", +referencedClasses: [], +messageSends: ["assert:equals:", "floor"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'initialization', +selector: "testHexNumbers", +protocol: 'tests', fn: function (){ var self=this; -function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@receiver"]=$recv($DoIt())._new(); +var $1,$2,$3,$4,$5; +self._assert_equals_((9),(9)); +$ctx1.sendIdx["assert:equals:"]=1; +$1=(10)._truncated(); +$ctx1.sendIdx["truncated"]=1; +self._assert_equals_($1,(10)); +$ctx1.sendIdx["assert:equals:"]=2; +$2=(11)._truncated(); +$ctx1.sendIdx["truncated"]=2; +self._assert_equals_($2,(11)); +$ctx1.sendIdx["assert:equals:"]=3; +$3=(12)._truncated(); +$ctx1.sendIdx["truncated"]=3; +self._assert_equals_($3,(12)); +$ctx1.sendIdx["assert:equals:"]=4; +$4=(13)._truncated(); +$ctx1.sendIdx["truncated"]=4; +self._assert_equals_($4,(13)); +$ctx1.sendIdx["assert:equals:"]=5; +$5=(14)._truncated(); +$ctx1.sendIdx["truncated"]=5; +self._assert_equals_($5,(14)); +$ctx1.sendIdx["assert:equals:"]=6; +self._assert_equals_((15)._truncated(),(15)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp\x0a\x09receiver := DoIt new", -referencedClasses: ["DoIt"], -//>>excludeEnd("ide"); -messageSends: ["new"] +source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15", +referencedClasses: [], +messageSends: ["assert:equals:", "truncated"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "should:receiver:return:", -protocol: 'testing', -fn: function (aString,anObject,aResult){ +selector: "testIdentity", +protocol: 'tests', +fn: function (){ var self=this; -var method,result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -self["@receiver"]=anObject; -$1=self._compiler(); -$2=$recv(anObject)._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); -method=$recv($1)._install_forClass_protocol_(aString,$2,"tests"); -result=$recv(self["@receiver"])._perform_($recv(method)._selector()); -$recv($recv(anObject)._class())._removeCompiledMethod_(method); -self._assert_equals_(aResult,result); +var $1,$2,$3,$5,$4,$7,$6,$9,$8; +$1=(1).__eq_eq((1)); +$ctx1.sendIdx["=="]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=(0).__eq_eq((0)); +$ctx1.sendIdx["=="]=2; +self._assert_($2); +$ctx1.sendIdx["assert:"]=2; +$3=(1).__eq_eq((0)); +$ctx1.sendIdx["=="]=3; +self._deny_($3); +$ctx1.sendIdx["deny:"]=1; +$5=(1)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$4=$recv($5).__eq_eq((1)); +$ctx1.sendIdx["=="]=4; +self._assert_($4); +$ctx1.sendIdx["assert:"]=3; +$7=(1)._yourself(); +$ctx1.sendIdx["yourself"]=2; +$6=(1).__eq_eq($7); +$ctx1.sendIdx["=="]=5; +self._assert_($6); +$ctx1.sendIdx["assert:"]=4; +$9=(1)._yourself(); +$ctx1.sendIdx["yourself"]=3; +$8=$recv($9).__eq_eq((1)._yourself()); +$ctx1.sendIdx["=="]=6; +self._assert_($8); +self._deny_((1).__eq_eq((2))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject", "aResult"], -source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result", +args: [], +source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"] +messageSends: ["assert:", "==", "deny:", "yourself"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "should:return:", -protocol: 'testing', -fn: function (aString,anObject){ +selector: "testInvalidHexNumbers", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._should_receiver_return_(aString,self["@receiver"],anObject); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rG(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=1; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rg(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=2; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rH(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=3; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rh(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=4; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rI(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=5; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._ri(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=6; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rJ(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=7; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rj(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=8; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rK(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=9; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rk(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=10; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rL(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=11; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rl(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=12; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rM(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=13; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rm(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=14; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rN(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=15; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rn(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=16; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rO(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=17; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._ro(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=18; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rP(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=19; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rp(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=20; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rQ(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=21; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rq(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=22; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rR(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=23; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rr(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=24; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rS(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=25; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rs(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=26; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rT(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=27; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rt(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=28; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rU(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=29; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._ru(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=30; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rV(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=31; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rv(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=32; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rW(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=33; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rw(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=34; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rX(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=35; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rx(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=36; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rY(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=37; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._ry(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=38; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rZ(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=39; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (16)._rz(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)}); +}),$MessageNotUnderstood()); +$ctx1.sendIdx["should:raise:"]=40; +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (11259375)._Z(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)}); +}),$MessageNotUnderstood()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:receiver:return:"] +args: [], +source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.", +referencedClasses: ["MessageNotUnderstood"], +messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "tearDown", -protocol: 'initialization', +selector: "testLog", +protocol: 'tests', fn: function (){ var self=this; +function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)} +return $core.withContext(function($ctx1) { +self._assert_equals_((10000)._log(),(4)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((512)._log_((2)),(9)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv($recv($Number())._e())._ln(),(1)); return self; - +}, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "tearDown\x0a\x09\x22receiver := nil\x22", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: [] +source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.", +referencedClasses: ["Number"], +messageSends: ["assert:equals:", "log", "log:", "ln", "e"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testAssignment", +selector: "testMinMax", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1)); +self._assert_equals_((2)._max_((5)),(5)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((2)._min_((5)),(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1", +source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "max:", "min:"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testBackslashSelectors", +selector: "testNegated", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("\x5c arg ^ 4",(4)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("\x5c\x5c arg ^ 42",(42)); +var $1; +$1=(3)._negated(); +$ctx1.sendIdx["negated"]=1; +self._assert_equals_($1,(-3)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((-3)._negated(),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42", +source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "negated"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testBlockReturn", +selector: "testPrintShowingDecimalPlaces", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]); +var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15; +$1=(23)._printShowingDecimalPlaces_((2)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=1; +self._assert_equals_($1,"23.00"); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(23.5698)._printShowingDecimalPlaces_((2)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=2; +self._assert_equals_($2,"23.57"); +$ctx1.sendIdx["assert:equals:"]=2; +$4=(234.567)._negated(); +$ctx1.sendIdx["negated"]=1; +$3=$recv($4)._printShowingDecimalPlaces_((5)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=3; +self._assert_equals_($3,"-234.56700"); +$ctx1.sendIdx["assert:equals:"]=3; +$5=(23.4567)._printShowingDecimalPlaces_((0)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=4; +self._assert_equals_($5,"23"); +$ctx1.sendIdx["assert:equals:"]=4; +$6=(23.5567)._printShowingDecimalPlaces_((0)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=5; +self._assert_equals_($6,"24"); +$ctx1.sendIdx["assert:equals:"]=5; +$8=(23.4567)._negated(); +$ctx1.sendIdx["negated"]=2; +$7=$recv($8)._printShowingDecimalPlaces_((0)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=6; +self._assert_equals_($7,"-23"); +$ctx1.sendIdx["assert:equals:"]=6; +$10=(23.5567)._negated(); +$ctx1.sendIdx["negated"]=3; +$9=$recv($10)._printShowingDecimalPlaces_((0)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=7; +self._assert_equals_($9,"-24"); +$ctx1.sendIdx["assert:equals:"]=7; +$11=(100000000)._printShowingDecimalPlaces_((1)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=8; +self._assert_equals_($11,"100000000.0"); +$ctx1.sendIdx["assert:equals:"]=8; +$12=(0.98)._printShowingDecimalPlaces_((5)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=9; +self._assert_equals_($12,"0.98000"); +$ctx1.sendIdx["assert:equals:"]=9; +$13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=10; +self._assert_equals_($13,"-0.98"); +$ctx1.sendIdx["assert:equals:"]=10; +$14=(2.567)._printShowingDecimalPlaces_((2)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=11; +self._assert_equals_($14,"2.57"); +$ctx1.sendIdx["assert:equals:"]=11; +$15=(-2.567)._printShowingDecimalPlaces_((2)); +$ctx1.sendIdx["printShowingDecimalPlaces:"]=12; +self._assert_equals_($15,"-2.57"); +$ctx1.sendIdx["assert:equals:"]=12; +self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).", +source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testCascades", +selector: "testRaisedTo", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]); +var $1,$2,$3; +$1=(2)._raisedTo_((4)); +$ctx1.sendIdx["raisedTo:"]=1; +self._assert_equals_($1,(16)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(2)._raisedTo_((0)); +$ctx1.sendIdx["raisedTo:"]=2; +self._assert_equals_($2,(1)); +$ctx1.sendIdx["assert:equals:"]=2; +$3=(2)._raisedTo_((-3)); +$ctx1.sendIdx["raisedTo:"]=3; +self._assert_equals_($3,(0.125)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_((4)._raisedTo_((0.5)),(2)); +$ctx1.sendIdx["assert:equals:"]=4; +self._assert_equals_((2).__star_star((4)),(16)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)", +source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "raisedTo:", "**"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testCascadesWithInlining", +selector: "testRounded", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2)); +var $1,$2; +$1=(3)._rounded(); +$ctx1.sendIdx["rounded"]=1; +self._assert_equals_($1,(3)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(3.212)._rounded(); +$ctx1.sendIdx["rounded"]=2; +self._assert_equals_($2,(3)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((3.51)._rounded(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2", +source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "rounded"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testDynamicArrayElementsOrdered", +selector: "testSign", protocol: 'tests', fn: function (){ -var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]); +var self=this; +return $core.withContext(function($ctx1) { +var $1,$2; +$1=(5)._sign(); +$ctx1.sendIdx["sign"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(0)._sign(); +$ctx1.sendIdx["sign"]=2; +self._assert_equals_($2,(0)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((-1.4)._sign(),(-1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).", +source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "sign"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testDynamicDictionaryElementsOrdered", +selector: "testSqrt", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)])); +var $1; +$1=(4)._sqrt(); +$ctx1.sendIdx["sqrt"]=1; +self._assert_equals_($1,(2)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((16)._sqrt(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.", +source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "sqrt"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testDynamicDictionaryWithMoreArrows", +selector: "testSquared", protocol: 'tests', fn: function (){ var self=this; -function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1; -$2=$recv((1).__minus_gt((2))).__minus_gt((3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=1; -//>>excludeEnd("ctx"); -$1=$recv($HashedCollection())._with_($2); -self._should_return_("foo ^ #{1->2->3}",$1); +self._assert_equals_((4)._squared(),(16)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)", -referencedClasses: ["HashedCollection"], -//>>excludeEnd("ide"); -messageSends: ["should:return:", "with:", "->"] +source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16", +referencedClasses: [], +messageSends: ["assert:equals:", "squared"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testGlobalVar", +selector: "testTimesRepeat", protocol: 'tests', fn: function (){ var self=this; -function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var i; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ eval class",$BlockClosure()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ Math cos: 0",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ NonExistingVar",nil); +i=(0); +(0)._timesRepeat_((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +$ctx2.sendIdx["+"]=1; +return i; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +$ctx1.sendIdx["timesRepeat:"]=1; +self._assert_equals_(i,(0)); +$ctx1.sendIdx["assert:equals:"]=1; +(5)._timesRepeat_((function(){ +return $core.withContext(function($ctx2) { +i=$recv(i).__plus((1)); +return i; +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); +})); +self._assert_equals_(i,(5)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil", -referencedClasses: ["BlockClosure"], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5", +referencedClasses: [], +messageSends: ["timesRepeat:", "+", "assert:equals:"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testInnerTemporalDependentElementsOrdered", +selector: "testTo", protocol: 'tests', fn: function (){ var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10; -$2="foo".__minus_gt($Array()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=1; -//>>excludeEnd("ctx"); -$3="bar".__minus_gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=2; -//>>excludeEnd("ctx"); -$1=[$2,$3]; -self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -$5="foo".__minus_gt($Array()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=3; -//>>excludeEnd("ctx"); -$6="bar".__minus_gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=4; -//>>excludeEnd("ctx"); -$4=[$5,$6]; -self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -$8="foo".__minus_gt((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=5; -//>>excludeEnd("ctx"); -$9="bar".__minus_gt((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=6; -//>>excludeEnd("ctx"); -$7=[$8,$9]; -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -$11="foo".__minus_gt((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["->"]=7; -//>>excludeEnd("ctx"); -$10=[$11,"bar".__minus_gt((2))]; -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)])); +self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["should:return:", "->"] +source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)", +referencedClasses: [], +messageSends: ["assert:equals:", "to:"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testJSStatement", +selector: "testToBy", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ",(5)); +var $1; +$1=(0)._to_by_((6),(2)); +$ctx1.sendIdx["to:by:"]=1; +self._assert_equals_($1,[(0), (2), (4), (6)]); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return (1)._to_by_((4),(0)); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testJSStatement\x0a\x09self should: 'foo ' return: 5", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error", +referencedClasses: ["Error"], +messageSends: ["assert:equals:", "to:by:", "should:raise:"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testLexicalScope", +selector: "testTrigonometry", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2)); +self._assert_equals_((0)._cos(),(1)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_((0)._sin(),(0)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((0)._tan(),(0)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_((1)._arcCos(),(0)); +$ctx1.sendIdx["assert:equals:"]=4; +self._assert_equals_((0)._arcSin(),(0)); +$ctx1.sendIdx["assert:equals:"]=5; +self._assert_equals_((0)._arcTan(),(0)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2", +source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); $core.addMethod( $core.method({ -selector: "testLiterals", +selector: "testTruncated", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 'hello'","hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true",true); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=5; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false",false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=6; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=7; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #hello","hello"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=8; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ $h","h"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=9; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ -123.456",(-123.456)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=10; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ -2.5e4",(-25000)); +var $1,$2; +$1=(3)._truncated(); +$ctx1.sendIdx["truncated"]=1; +self._assert_equals_($1,(3)); +$ctx1.sendIdx["assert:equals:"]=1; +$2=(3.212)._truncated(); +$ctx1.sendIdx["truncated"]=2; +self._assert_equals_($2,(3)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_((3.51)._truncated(),(3)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.", +source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "truncated"] }), -$globals.CodeGeneratorTest); +$globals.NumberTest); + + +$core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests'); +$globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes."; $core.addMethod( $core.method({ -selector: "testLocalReturn", -protocol: 'tests', +selector: "foo", +protocol: 'not yet classified', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 + 1",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ",self["@receiver"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo self asString",self["@receiver"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3)); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=self["@foo"]; +return $1; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3", +source: "foo\x0a\x09^ foo", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: [] }), -$globals.CodeGeneratorTest); +$globals.ObjectMock); $core.addMethod( $core.method({ -selector: "testMessageSends", -protocol: 'tests', -fn: function (){ +selector: "foo:", +protocol: 'not yet classified', +fn: function (anObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 asString","1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 + 1",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 + 2 * 3",(9)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]); +self["@foo"]=anObject; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: [], -source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)", +args: ["anObject"], +source: "foo: anObject\x0a\x09foo := anObject", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: [] }), -$globals.CodeGeneratorTest); +$globals.ObjectMock); + + +$core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testMultipleSequences", +selector: "notDefined", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30)); +return void 0;; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30", +source: "notDefined\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: [] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testMutableLiterals", +selector: "testBasicAccess", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]); +var $1; +o=$recv($Object())._new(); +$recv(o)._basicAt_put_("a",(1)); +$1=$recv(o)._basicAt_("a"); +$ctx1.sendIdx["basicAt:"]=1; +self._assert_equals_($1,(1)); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv(o)._basicAt_("b"),nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil", +referencedClasses: ["Object"], +messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testNestedIfTrue", +selector: "testBasicPerform", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]); +o=$recv($Object())._new(); +$recv(o)._basicAt_put_("func",(function(){ +return "hello"; + +})); +$ctx1.sendIdx["basicAt:put:"]=1; +$recv(o)._basicAt_put_("func2",(function(a){ +return $core.withContext(function($ctx2) { +return $recv(a).__plus((1)); +}, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)}); +})); +self._assert_equals_($recv(o)._basicPerform_("func"),"hello"); +$ctx1.sendIdx["assert:equals:"]=1; +self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4", +referencedClasses: ["Object"], +messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testNestedSends", +selector: "testDNU", protocol: 'tests', fn: function (){ var self=this; -function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString()); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv($Object())._new())._foo(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$MessageNotUnderstood()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString", -referencedClasses: ["Point"], -//>>excludeEnd("ide"); -messageSends: ["should:return:", "asString", "x:y:", "@"] +source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood", +referencedClasses: ["Object", "MessageNotUnderstood"], +messageSends: ["should:raise:", "foo", "new"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testNonLocalReturn", +selector: "testEquality", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo [ ^ 1 ] value",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo [ ^ 1 + 1 ] value",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8)); +var $1,$2,$4,$3; +o=$recv($Object())._new(); +$ctx1.sendIdx["new"]=1; +$1=$recv(o).__eq($recv($Object())._new()); +$ctx1.sendIdx["="]=1; +self._deny_($1); +$2=$recv(o).__eq(o); +$ctx1.sendIdx["="]=2; +self._assert_($2); +$ctx1.sendIdx["assert:"]=1; +$4=$recv(o)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$3=$recv($4).__eq(o); +$ctx1.sendIdx["="]=3; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +self._assert_($recv(o).__eq($recv(o)._yourself())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)", +referencedClasses: ["Object"], +messageSends: ["new", "deny:", "=", "assert:", "yourself"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testPascalCaseGlobal", +selector: "testHalt", protocol: 'tests', fn: function (){ var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^NonExistent",nil); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv($recv($Object())._new())._halt(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["should:return:", "at:", "globals"] +source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error", +referencedClasses: ["Object", "Error"], +messageSends: ["should:raise:", "halt", "new"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testSendReceiverAndArgumentsOrdered", +selector: "testIdentity", protocol: 'tests', fn: function (){ var self=this; -function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]); +var $1,$2,$4,$3; +o=$recv($Object())._new(); +$ctx1.sendIdx["new"]=1; +$1=$recv(o).__eq_eq($recv($Object())._new()); +$ctx1.sendIdx["=="]=1; +self._deny_($1); +$2=$recv(o).__eq_eq(o); +$ctx1.sendIdx["=="]=2; +self._assert_($2); +$ctx1.sendIdx["assert:"]=1; +$4=$recv(o)._yourself(); +$ctx1.sendIdx["yourself"]=1; +$3=$recv($4).__eq_eq(o); +$ctx1.sendIdx["=="]=3; +self._assert_($3); +$ctx1.sendIdx["assert:"]=2; +self._assert_($recv(o).__eq_eq($recv(o)._yourself())); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.", -referencedClasses: ["Array"], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself", +referencedClasses: ["Object"], +messageSends: ["new", "deny:", "==", "assert:", "yourself"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testSuperSend", +selector: "testIfNil", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_receiver_return_("foo ^ super isBoolean",true,false); +var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver; +$2=$recv($Object())._new(); +$ctx1.sendIdx["new"]=1; +$1=$recv($2)._isNil(); +self._deny_($1); +$ctx1.sendIdx["deny:"]=1; +$5=$recv($Object())._new(); +$ctx1.sendIdx["new"]=2; +if(($receiver = $5) == null || $receiver.isNil){ +$4=true; +} else { +$4=$5; +}; +$3=$recv($4).__eq(true); +self._deny_($3); +$7=$recv($Object())._new(); +$ctx1.sendIdx["new"]=3; +if(($receiver = $7) == null || $receiver.isNil){ +$6=$7; +} else { +$6=true; +}; +self._assert_equals_($6,true); +$ctx1.sendIdx["assert:equals:"]=1; +$9=$recv($Object())._new(); +$ctx1.sendIdx["new"]=4; +if(($receiver = $9) == null || $receiver.isNil){ +$8=false; +} else { +$8=true; +}; +self._assert_equals_($8,true); +$ctx1.sendIdx["assert:equals:"]=2; +$11=$recv($Object())._new(); +if(($receiver = $11) == null || $receiver.isNil){ +$10=false; +} else { +$10=true; +}; +self._assert_equals_($10,true); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:receiver:return:"] +source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true", +referencedClasses: ["Object"], +messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testTempVariables", +selector: "testInstVars", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo | a | ^ a",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo | AVariable | ^ AVariable",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo | a b c | ^ c",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo | a | [ | d | ^ d ] value",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo | a | a:= 1. ^ a",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=5; -//>>excludeEnd("ctx"); -self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1)); +var $1,$2; +o=$recv($ObjectMock())._new(); +$1=$recv(o)._instVarAt_("foo"); +$ctx1.sendIdx["instVarAt:"]=1; +self._assert_equals_($1,nil); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(o)._instVarAt_put_("foo",(1)); +$2=$recv(o)._instVarAt_("foo"); +$ctx1.sendIdx["instVarAt:"]=2; +self._assert_equals_($2,(1)); +$ctx1.sendIdx["assert:equals:"]=2; +self._assert_equals_($recv(o)._instVarAt_("foo"),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1", +referencedClasses: ["ObjectMock"], +messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testThisContext", +selector: "testNilUndefined", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true); +self._assert_equals_(self._notDefined(),nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true", +source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:equals:", "notDefined"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testifFalse", +selector: "testYourself", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o; +function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo false ifFalse: [ ^ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifFalse: [ 1 ]",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false ifFalse: [ 2 ]",(2)); +o=$recv($ObjectMock())._new(); +self._assert_($recv($recv(o)._yourself()).__eq_eq(o)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o", +referencedClasses: ["ObjectMock"], +messageSends: ["new", "assert:", "==", "yourself"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); $core.addMethod( $core.method({ -selector: "testifFalseIfTrue", +selector: "testidentityHash", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var o1,o2; +function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2)); +var $2,$3,$1,$5,$4; +o1=$recv($Object())._new(); +$ctx1.sendIdx["new"]=1; +o2=$recv($Object())._new(); +$2=$recv(o1)._identityHash(); +$ctx1.sendIdx["identityHash"]=1; +$3=$recv(o1)._identityHash(); +$ctx1.sendIdx["identityHash"]=2; +$1=$recv($2).__eq_eq($3); +$ctx1.sendIdx["=="]=1; +self._assert_($1); +$5=$recv(o1)._identityHash(); +$ctx1.sendIdx["identityHash"]=3; +$4=$recv($5).__eq_eq($recv(o2)._identityHash()); +self._deny_($4); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash", +referencedClasses: ["Object"], +messageSends: ["new", "assert:", "==", "identityHash", "deny:"] }), -$globals.CodeGeneratorTest); +$globals.ObjectTest); + + +$core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testifNil", +selector: "testAccessing", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNil: [ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo nil ifNil: [ ^ 2 ]",(2)); +var $2,$1,$3,$6,$5,$4; +$2=$recv($Point())._x_y_((3),(4)); +$ctx1.sendIdx["x:y:"]=1; +$1=$recv($2)._x(); +$ctx1.sendIdx["x"]=1; +self._assert_equals_($1,(3)); +$ctx1.sendIdx["assert:equals:"]=1; +$3=$recv($recv($Point())._x_y_((3),(4)))._y(); +$ctx1.sendIdx["y"]=1; +self._assert_equals_($3,(4)); +$ctx1.sendIdx["assert:equals:"]=2; +$6=$recv($Point())._new(); +$ctx1.sendIdx["new"]=1; +$5=$recv($6)._x_((3)); +$4=$recv($5)._x(); +self._assert_equals_($4,(3)); +$ctx1.sendIdx["assert:equals:"]=3; +self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4", +referencedClasses: ["Point"], +messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"] }), -$globals.CodeGeneratorTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "testifNilIfNotNil", +selector: "testArithmetic", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2)); +var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13; +$2=(3).__at((4)); +$ctx1.sendIdx["@"]=1; +$3=(3).__at((4)); +$ctx1.sendIdx["@"]=2; +$1=$recv($2).__star($3); +$4=$recv($Point())._x_y_((9),(16)); +$ctx1.sendIdx["x:y:"]=1; +self._assert_equals_($1,$4); +$ctx1.sendIdx["assert:equals:"]=1; +$6=(3).__at((4)); +$ctx1.sendIdx["@"]=3; +$7=(3).__at((4)); +$ctx1.sendIdx["@"]=4; +$5=$recv($6).__plus($7); +$8=$recv($Point())._x_y_((6),(8)); +$ctx1.sendIdx["x:y:"]=2; +self._assert_equals_($5,$8); +$ctx1.sendIdx["assert:equals:"]=2; +$10=(3).__at((4)); +$ctx1.sendIdx["@"]=5; +$11=(3).__at((4)); +$ctx1.sendIdx["@"]=6; +$9=$recv($10).__minus($11); +$12=$recv($Point())._x_y_((0),(0)); +$ctx1.sendIdx["x:y:"]=3; +self._assert_equals_($9,$12); +$ctx1.sendIdx["assert:equals:"]=3; +$14=(6).__at((8)); +$ctx1.sendIdx["@"]=7; +$13=$recv($14).__slash((3).__at((4))); +self._assert_equals_($13,$recv($Point())._x_y_((2),(2))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)", +referencedClasses: ["Point"], +messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"] }), -$globals.CodeGeneratorTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "testifNotNil", +selector: "testAt", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]); +self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)", +referencedClasses: ["Point"], +messageSends: ["assert:equals:", "@", "x:y:"] }), -$globals.CodeGeneratorTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "testifNotNilWithArgument", +selector: "testComparison", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=4; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=5; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5)); +var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22; +$2=(3).__at((4)); +$ctx1.sendIdx["@"]=1; +$3=(4).__at((5)); +$ctx1.sendIdx["@"]=2; +$1=$recv($2).__lt($3); +$ctx1.sendIdx["<"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$5=(3).__at((4)); +$ctx1.sendIdx["@"]=3; +$6=(4).__at((4)); +$ctx1.sendIdx["@"]=4; +$4=$recv($5).__lt($6); +self._deny_($4); +$ctx1.sendIdx["deny:"]=1; +$8=(4).__at((5)); +$ctx1.sendIdx["@"]=5; +$9=(4).__at((5)); +$ctx1.sendIdx["@"]=6; +$7=$recv($8).__lt_eq($9); +$ctx1.sendIdx["<="]=1; +self._assert_($7); +$ctx1.sendIdx["assert:"]=2; +$11=(4).__at((5)); +$ctx1.sendIdx["@"]=7; +$12=(3).__at((5)); +$ctx1.sendIdx["@"]=8; +$10=$recv($11).__lt_eq($12); +self._deny_($10); +$ctx1.sendIdx["deny:"]=2; +$14=(5).__at((6)); +$ctx1.sendIdx["@"]=9; +$15=(4).__at((5)); +$ctx1.sendIdx["@"]=10; +$13=$recv($14).__gt($15); +$ctx1.sendIdx[">"]=1; +self._assert_($13); +$ctx1.sendIdx["assert:"]=3; +$17=(5).__at((6)); +$ctx1.sendIdx["@"]=11; +$18=(6).__at((6)); +$ctx1.sendIdx["@"]=12; +$16=$recv($17).__gt($18); +self._deny_($16); +$ctx1.sendIdx["deny:"]=3; +$20=(4).__at((5)); +$ctx1.sendIdx["@"]=13; +$21=(4).__at((5)); +$ctx1.sendIdx["@"]=14; +$19=$recv($20).__gt_eq($21); +$ctx1.sendIdx[">="]=1; +self._assert_($19); +$23=(4).__at((5)); +$ctx1.sendIdx["@"]=15; +$22=$recv($23).__gt_eq((5).__at((5))); +self._deny_($22); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5", +source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="] }), -$globals.CodeGeneratorTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "testifTrue", +selector: "testEgality", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo true ifTrue: [ ^ 2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false ifTrue: [ 1 ]",nil); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifTrue: [ 2 ]",(2)); +var $2,$3,$1,$5,$4; +$2=(3).__at((4)); +$ctx1.sendIdx["@"]=1; +$3=(3).__at((4)); +$ctx1.sendIdx["@"]=2; +$1=$recv($2).__eq($3); +$ctx1.sendIdx["="]=1; +self._assert_($1); +$5=(3).__at((5)); +$ctx1.sendIdx["@"]=3; +$4=$recv($5).__eq((3).__at((6))); +self._deny_($4); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.", +source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] +messageSends: ["assert:", "=", "@", "deny:"] }), -$globals.CodeGeneratorTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "testifTrueIfFalse", +selector: "testNew", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=1; -//>>excludeEnd("ctx"); -self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=2; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["should:return:"]=3; -//>>excludeEnd("ctx"); -self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2)); +var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8; +$3=$recv($Point())._new(); +$ctx1.sendIdx["new"]=1; +$2=$recv($3)._x_((3)); +$ctx1.sendIdx["x:"]=1; +$1=$recv($2)._y(); +$ctx1.sendIdx["y"]=1; +self._assert_equals_($1,nil); +$ctx1.sendIdx["assert:equals:"]=1; +$7=$recv($Point())._new(); +$ctx1.sendIdx["new"]=2; +$6=$recv($7)._x_((3)); +$5=$recv($6)._x(); +$ctx1.sendIdx["x"]=1; +$4=$recv($5).__eq((0)); +$ctx1.sendIdx["="]=1; +self._deny_($4); +$ctx1.sendIdx["deny:"]=1; +$10=$recv($Point())._new(); +$ctx1.sendIdx["new"]=3; +$9=$recv($10)._y_((4)); +$ctx1.sendIdx["y:"]=1; +$8=$recv($9)._x(); +self._assert_equals_($8,nil); +self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:return:"] -}), -$globals.CodeGeneratorTest); - - - -$core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests'); -$core.addMethod( -$core.method({ -selector: "analyze:forClass:", -protocol: 'parsing', -fn: function (aNode,aClass){ -var self=this; -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -$recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode); -return aNode; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aNode", "aClass"], -source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode", -referencedClasses: ["SemanticAnalyzer"], -//>>excludeEnd("ide"); -messageSends: ["visit:", "on:"] -}), -$globals.ASTInterpreterTest); - -$core.addMethod( -$core.method({ -selector: "interpret:receiver:withArguments:", -protocol: 'private', -fn: function (aString,anObject,aDictionary){ -var self=this; -var ctx,ast,interpreter; -function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} -function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$5,$6,$4,$receiver; -interpreter=$recv($ASTInterpreter())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -ast=self._parse_forClass_(aString,$recv(anObject)._class()); -$1=$recv($AIContext())._new(); -$recv($1)._receiver_(anObject); -$recv($1)._interpreter_(interpreter); -$2=$recv($1)._yourself(); -ctx=$2; -$3=$recv(ast)._sequenceNode(); -if(($receiver = $3) == null || $receiver.isNil){ -$3; -} else { -var sequence; -sequence=$receiver; -$recv($recv(sequence)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(ctx)._defineLocal_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -}; -$recv(aDictionary)._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(ctx)._localAt_put_(key,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); -})); -$5=interpreter; -$recv($5)._context_(ctx); -$recv($5)._interpret_($recv(ast)._nextChild()); -$recv($5)._proceed(); -$6=$recv($5)._result(); -$4=$6; -return $4; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject", "aDictionary"], -source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result", -referencedClasses: ["ASTInterpreter", "AIContext"], -//>>excludeEnd("ide"); -messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"] -}), -$globals.ASTInterpreterTest); - -$core.addMethod( -$core.method({ -selector: "parse:", -protocol: 'parsing', -fn: function (aString){ -var self=this; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=$recv($Smalltalk())._parse_(aString); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); -}, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString"], -source: "parse: aString\x0a\x09^ Smalltalk parse: aString", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:"] +source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0", +referencedClasses: ["Point"], +messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"] }), -$globals.ASTInterpreterTest); +$globals.PointTest); $core.addMethod( $core.method({ -selector: "parse:forClass:", -protocol: 'parsing', -fn: function (aString,aClass){ +selector: "testTranslateBy", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._analyze_forClass_(self._parse_(aString),aClass); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); +var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14; +$2=(3).__at((3)); +$ctx1.sendIdx["@"]=1; +$3=(0).__at((1)); +$ctx1.sendIdx["@"]=2; +$1=$recv($2)._translateBy_($3); +$ctx1.sendIdx["translateBy:"]=1; +$4=(3).__at((4)); +$ctx1.sendIdx["@"]=3; +self._assert_equals_($1,$4); +$ctx1.sendIdx["assert:equals:"]=1; +$6=(3).__at((3)); +$ctx1.sendIdx["@"]=4; +$8=(1)._negated(); +$ctx1.sendIdx["negated"]=1; +$7=(0).__at($8); +$ctx1.sendIdx["@"]=5; +$5=$recv($6)._translateBy_($7); +$ctx1.sendIdx["translateBy:"]=2; +$9=(3).__at((2)); +$ctx1.sendIdx["@"]=6; +self._assert_equals_($5,$9); +$ctx1.sendIdx["assert:equals:"]=2; +$11=(3).__at((3)); +$ctx1.sendIdx["@"]=7; +$12=(2).__at((3)); +$ctx1.sendIdx["@"]=8; +$10=$recv($11)._translateBy_($12); +$ctx1.sendIdx["translateBy:"]=3; +$13=(5).__at((6)); +$ctx1.sendIdx["@"]=9; +self._assert_equals_($10,$13); +$ctx1.sendIdx["assert:equals:"]=3; +$15=(3).__at((3)); +$ctx1.sendIdx["@"]=10; +$16=$recv((3)._negated()).__at((0)); +$ctx1.sendIdx["@"]=11; +$14=$recv($15)._translateBy_($16); +self._assert_equals_($14,(0).__at((3))); +return self; +}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "aClass"], -source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass", +args: [], +source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.", referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["analyze:forClass:", "parse:"] +messageSends: ["assert:equals:", "translateBy:", "@", "negated"] }), -$globals.ASTInterpreterTest); +$globals.PointTest); + + +$core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "should:receiver:return:", -protocol: 'testing', -fn: function (aString,anObject,aResult){ +selector: "testNextIfAbsent", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var queue; +function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -self["@receiver"]=anObject; -$1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); +var $2,$1; +queue=$recv($Queue())._new(); +$recv(queue)._nextPut_("index1"); +$2=$recv(queue)._nextIfAbsent_("empty"); +$ctx1.sendIdx["nextIfAbsent:"]=1; +$1=$recv($2).__eq("index1"); +$ctx1.sendIdx["="]=1; +self._assert_($1); +self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1")); +return self; +}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject", "aResult"], -source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["assert:equals:", "interpret:receiver:withArguments:"] +args: [], +source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'", +referencedClasses: ["Queue"], +messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"] }), -$globals.ASTInterpreterTest); +$globals.QueueTest); $core.addMethod( $core.method({ -selector: "should:return:", -protocol: 'testing', -fn: function (aString,anObject){ +selector: "testQueueNext", +protocol: 'tests', +fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var queue; +function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)} +function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1; -$1=self._should_receiver_return_(aString,self["@receiver"],anObject); -return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)}); -//>>excludeEnd("ctx"); +var $1,$2,$4,$3,$6,$5; +queue=$recv($Queue())._new(); +$1=queue; +$recv($1)._nextPut_("index1"); +$ctx1.sendIdx["nextPut:"]=1; +$2=$recv($1)._nextPut_("index2"); +$4=$recv(queue)._next(); +$ctx1.sendIdx["next"]=1; +$3=$recv($4).__eq("index1"); +$ctx1.sendIdx["="]=1; +self._assert_($3); +$6=$recv(queue)._next(); +$ctx1.sendIdx["next"]=2; +$5=$recv($6).__eq("index"); +self._deny_($5); +self._should_raise_((function(){ +return $core.withContext(function($ctx2) { +return $recv(queue)._next(); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +}),$Error()); +return self; +}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject"], -source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject", -referencedClasses: [], -//>>excludeEnd("ide"); -messageSends: ["should:receiver:return:"] +args: [], +source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error", +referencedClasses: ["Queue", "Error"], +messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"] }), -$globals.ASTInterpreterTest); +$globals.QueueTest); -$core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests'); +$core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "interpret:receiver:withArguments:", -protocol: 'private', -fn: function (aString,anObject,aDictionary){ +selector: "testAtRandomNumber", +protocol: 'tests', +fn: function (){ var self=this; -var ctx,ast,debugger_; -function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} -function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)} -function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var val; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4,$6,$7,$5,$receiver; -$1=$recv($AIContext())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._receiver_(anObject); -$recv($1)._interpreter_($recv($ASTInterpreter())._new()); -$2=$recv($1)._yourself(); -ctx=$2; -ast=self._parse_forClass_(aString,$recv(anObject)._class()); -$3=$recv(ast)._sequenceNode(); -if(($receiver = $3) == null || $receiver.isNil){ -$3; -} else { -var sequence; -sequence=$receiver; -$recv($recv(sequence)._temps())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(ctx)._defineLocal_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); -})); -}; -$recv(aDictionary)._keysAndValuesDo_((function(key,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +(100)._timesRepeat_((function(){ return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(ctx)._localAt_put_(key,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)}); -//>>excludeEnd("ctx"); +val=(10)._atRandom(); +val; +self._assert_($recv(val).__gt((0))); +$ctx2.sendIdx["assert:"]=1; +return self._assert_($recv(val).__lt((11))); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); })); -$4=$recv(ctx)._interpreter(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["interpreter"]=1; -//>>excludeEnd("ctx"); -$recv($4)._context_(ctx); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["context:"]=1; -//>>excludeEnd("ctx"); -$recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild()); -debugger_=$recv($ASTDebugger())._context_(ctx); -$6=debugger_; -$recv($6)._proceed(); -$7=$recv($6)._result(); -$5=$7; -return $5; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)}); -//>>excludeEnd("ctx"); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); -args: ["aString", "anObject", "aDictionary"], -source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result", -referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"], -//>>excludeEnd("ide"); -messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"] +args: [], +source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]", +referencedClasses: [], +messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"] }), -$globals.ASTDebuggerTest); - - +$globals.RandomTest); -$core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "codeGeneratorClass", -protocol: 'accessing', +selector: "testAtRandomSequenceableCollection", +protocol: 'tests', fn: function (){ var self=this; -function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)} -return $InliningCodeGenerator(); - +var val; +return $core.withContext(function($ctx1) { +var $3,$4,$2,$1; +(100)._timesRepeat_((function(){ +return $core.withContext(function($ctx2) { +val="abc"._atRandom(); +val; +$3=$recv(val).__eq("a"); +$ctx2.sendIdx["="]=1; +$4=$recv(val).__eq("b"); +$ctx2.sendIdx["="]=2; +$2=$recv($3).__or($4); +$1=$recv($2).__or($recv(val).__eq("c")); +$ctx2.sendIdx["|"]=1; +return self._assert_($1); +}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); +})); +return self; +}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator", -referencedClasses: ["InliningCodeGenerator"], -//>>excludeEnd("ide"); -messageSends: [] +source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].", +referencedClasses: [], +messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="] }), -$globals.InliningCodeGeneratorTest); - - +$globals.RandomTest); -$core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "testClassRefVar", +selector: "textNext", protocol: 'tests', fn: function (){ var self=this; -var node; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)} return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$3,$4; -$1=$recv($VariableNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._value_("Object"); -$2=$recv($1)._yourself(); -node=$2; -$3=$recv($SemanticAnalyzer())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=2; -//>>excludeEnd("ctx"); -$recv($3)._pushScope_($recv($MethodLexicalScope())._new()); -$4=$recv($3)._visit_(node); -self._assert_($recv($recv(node)._binding())._isClassRefVar()); +var $1; +(10000)._timesRepeat_((function(){ +var current,next; +return $core.withContext(function($ctx2) { +next=$recv($recv($Random())._new())._next(); +next; +self._assert_($recv(next).__gt_eq((0))); +$ctx2.sendIdx["assert:"]=1; +self._assert_($recv(next).__lt((1))); +$1=$recv(current).__eq(next); +$ctx2.sendIdx["="]=1; +self._deny_($1); +return $recv(next).__eq(current); +}, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)}); +})); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar", -referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"] +source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]", +referencedClasses: ["Random"], +messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="] }), -$globals.ScopeVarTest); +$globals.RandomTest); + + +$core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testInstanceVar", -protocol: 'tests', +selector: "collectionClass", +protocol: 'accessing', fn: function (){ var self=this; -var node,scope; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($VariableNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._value_("bzzz"); -$2=$recv($1)._yourself(); -node=$2; -scope=$recv($MethodLexicalScope())._new(); -$recv(scope)._addIVar_("bzzz"); -self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._class())._collectionClass(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar", -referencedClasses: ["VariableNode", "MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"] +source: "collectionClass\x0a\x09^ self class collectionClass", +referencedClasses: [], +messageSends: ["collectionClass", "class"] }), -$globals.ScopeVarTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testPseudoVar", -protocol: 'tests', +selector: "newCollection", +protocol: 'accessing', fn: function (){ var self=this; -var node,pseudoVars; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -pseudoVars=["self", "super", "true", "false", "nil"]; -$recv(pseudoVars)._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -$1=$recv($VariableNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx2.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._value_(each); -$2=$recv($1)._yourself(); -node=$2; -node; -return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); -})); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._collectionClass())._new(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]", -referencedClasses: ["VariableNode", "MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"] +source: "newCollection\x0a\x09^ self collectionClass new", +referencedClasses: [], +messageSends: ["new", "collectionClass"] }), -$globals.ScopeVarTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testTempVar", -protocol: 'tests', +selector: "newStream", +protocol: 'accessing', fn: function (){ var self=this; -var node,scope; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($VariableNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._value_("bzzz"); -$2=$recv($1)._yourself(); -node=$2; -scope=$recv($MethodLexicalScope())._new(); -$recv(scope)._addTemp_("bzzz"); -self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv($recv(self._collectionClass())._new())._stream(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar", -referencedClasses: ["VariableNode", "MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"] +source: "newStream\x0a\x09^ self collectionClass new stream", +referencedClasses: [], +messageSends: ["stream", "new", "collectionClass"] }), -$globals.ScopeVarTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testUnknownVar", +selector: "testAtStartAtEnd", protocol: 'tests', fn: function (){ var self=this; -var node; -function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)} -function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2; -$1=$recv($VariableNode())._new(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["new"]=1; -//>>excludeEnd("ctx"); -$recv($1)._value_("bzzz"); -$2=$recv($1)._yourself(); -node=$2; -self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil()); +var $1,$2,$3,$4; +stream=self._newStream(); +$1=$recv(stream)._atStart(); +$ctx1.sendIdx["atStart"]=1; +self._assert_($1); +$ctx1.sendIdx["assert:"]=1; +$2=$recv(stream)._atEnd(); +$ctx1.sendIdx["atEnd"]=1; +self._assert_($2); +$ctx1.sendIdx["assert:"]=2; +$recv(stream)._nextPutAll_(self._newCollection()); +$3=$recv(stream)._atEnd(); +$ctx1.sendIdx["atEnd"]=2; +self._assert_($3); +$4=$recv(stream)._atStart(); +$ctx1.sendIdx["atStart"]=2; +self._deny_($4); +$ctx1.sendIdx["deny:"]=1; +$recv(stream)._position_((1)); +self._deny_($recv(stream)._atEnd()); +$ctx1.sendIdx["deny:"]=2; +self._deny_($recv(stream)._atStart()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil", -referencedClasses: ["VariableNode", "MethodLexicalScope"], -//>>excludeEnd("ide"); -messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"] +source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart", +referencedClasses: [], +messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"] }), -$globals.ScopeVarTest); - - +$globals.StreamTest); -$core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'running', +selector: "testContents", +protocol: 'tests', fn: function (){ var self=this; -function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)} -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object()); +var $1,$2; +stream=self._newStream(); +$1=stream; +$2=self._newCollection(); +$ctx1.sendIdx["newCollection"]=1; +$recv($1)._nextPutAll_($2); +self._assert_equals_($recv(stream)._contents(),self._newCollection()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object", -referencedClasses: ["SemanticAnalyzer", "Object"], -//>>excludeEnd("ide"); -messageSends: ["on:"] +source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection", +referencedClasses: [], +messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testAssignment", +selector: "testIsEmpty", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo self := 1"; -ast=$recv($Smalltalk())._parse_(src); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$InvalidAssignmentError()); +var $1; +stream=self._newStream(); +$1=$recv(stream)._isEmpty(); +$ctx1.sendIdx["isEmpty"]=1; +self._assert_($1); +$recv(stream)._nextPutAll_(self._newCollection()); +self._deny_($recv(stream)._isEmpty()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError", -referencedClasses: ["Smalltalk", "InvalidAssignmentError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "should:raise:", "visit:"] +source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty", +referencedClasses: [], +messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testNonLocalReturn", +selector: "testPosition", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var collection,stream; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. ^ a"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn()); +var $1,$2,$3; +collection=self._newCollection(); +stream=self._newStream(); +$recv(stream)._nextPutAll_(collection); +$1=$recv(stream)._position(); +$ctx1.sendIdx["position"]=1; +self._assert_equals_($1,$recv(collection)._size()); +$ctx1.sendIdx["assert:equals:"]=1; +$recv(stream)._position_((0)); +$2=$recv(stream)._position(); +$ctx1.sendIdx["position"]=2; +self._assert_equals_($2,(0)); +$ctx1.sendIdx["assert:equals:"]=2; +$recv(stream)._next(); +$ctx1.sendIdx["next"]=1; +$3=$recv(stream)._position(); +$ctx1.sendIdx["position"]=3; +self._assert_equals_($3,(1)); +$ctx1.sendIdx["assert:equals:"]=3; +$recv(stream)._next(); +self._assert_equals_($recv(stream)._position(),(2)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"] +source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2", +referencedClasses: [], +messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testNonLocalReturn2", +selector: "testReading", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream,collection; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. [ [ ^ a] ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn()); +var $1,$2,$3; +collection=self._newCollection(); +stream=self._newStream(); +$1=stream; +$recv($1)._nextPutAll_(collection); +$2=$recv($1)._position_((0)); +$recv(collection)._do_((function(each){ +return $core.withContext(function($ctx2) { +$3=$recv(stream)._next(); +$ctx2.sendIdx["next"]=1; +return self._assert_equals_($3,each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._assert_($recv($recv(stream)._next())._isNil()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"] +source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil", +referencedClasses: [], +messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testScope", +selector: "testStreamContents", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $4,$3,$2,$1; -src="foo | a | a + 1. [ | b | b := a ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -$4=$recv($recv($recv(ast)._nodes())._first())._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._last(); -$2=$recv($3)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq_eq($recv(ast)._scope()); -self._deny_($1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"] +source: "testStreamContents", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testScope2", +selector: "testWrite", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream,collection; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $8,$7,$6,$5,$4,$3,$2,$1; -src="foo | a | a + 1. [ [ | b | b := a ] ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -$8=$recv($recv($recv(ast)._nodes())._first())._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=3; -//>>excludeEnd("ctx"); -$7=$recv($8)._last(); -$6=$recv($7)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=2; -//>>excludeEnd("ctx"); -$4=$recv($5)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2).__eq_eq($recv(ast)._scope()); -self._deny_($1); +collection=self._newCollection(); +stream=self._newStream(); +$recv(collection)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(stream).__lt_lt(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +self._assert_equals_($recv(stream)._contents(),collection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"] +source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection", +referencedClasses: [], +messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); $core.addMethod( $core.method({ -selector: "testScopeLevel", +selector: "testWriting", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var stream,collection; return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3; -src="foo | a | a + 1. [ [ | b | b := a ] ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -$2=$recv(ast)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._scopeLevel(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scopeLevel"]=1; -//>>excludeEnd("ctx"); -self._assert_equals_($1,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); +var $1; +collection=self._newCollection(); +stream=self._newStream(); +$ctx1.sendIdx["newStream"]=1; +$recv(collection)._do_((function(each){ +return $core.withContext(function($ctx2) { +return $recv(stream)._nextPut_(each); +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); +})); +$1=$recv(stream)._contents(); +$ctx1.sendIdx["contents"]=1; +self._assert_equals_($1,collection); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -$10=$recv($recv($recv(ast)._nodes())._first())._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=3; -//>>excludeEnd("ctx"); -$9=$recv($10)._last(); -$8=$recv($9)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=2; -//>>excludeEnd("ctx"); -$7=$recv($8)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$5=$recv($6)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._scope(); -$3=$recv($4)._scopeLevel(); -self._assert_equals_($3,(3)); +stream=self._newStream(); +$recv(stream)._nextPutAll_(collection); +self._assert_equals_($recv(stream)._contents(),collection); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"] +source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection", +referencedClasses: [], +messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest); + $core.addMethod( $core.method({ -selector: "testUnknownVariables", -protocol: 'tests', +selector: "collectionClass", +protocol: 'accessing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | b + a"; -ast=$recv($Smalltalk())._parse_(src); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$UnknownVariableError()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +return nil; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError", -referencedClasses: ["Smalltalk", "UnknownVariableError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "should:raise:", "visit:"] +source: "collectionClass\x0a\x09^ nil", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest.klass); $core.addMethod( $core.method({ -selector: "testUnknownVariablesWithScope", -protocol: 'tests', +selector: "isAbstract", +protocol: 'testing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]"; -ast=$recv($Smalltalk())._parse_(src); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$UnknownVariableError()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=$recv(self._collectionClass())._isNil(); +return $1; +}, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError", -referencedClasses: ["Smalltalk", "UnknownVariableError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "should:raise:", "visit:"] +source: "isAbstract\x0a\x09^ self collectionClass isNil", +referencedClasses: [], +messageSends: ["isNil", "collectionClass"] }), -$globals.SemanticAnalyzerTest); +$globals.StreamTest.klass); + +$core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testVariableShadowing", -protocol: 'tests', +selector: "newCollection", +protocol: 'accessing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +var $1; +$1=[true,(1),(3).__at((4)),"foo"]; +return $1; +}, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:"] +source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }", +referencedClasses: [], +messageSends: ["@"] }), -$globals.SemanticAnalyzerTest); +$globals.ArrayStreamTest); + $core.addMethod( $core.method({ -selector: "testVariableShadowing2", -protocol: 'tests', +selector: "collectionClass", +protocol: 'accessing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. [ | a | a := 2 ]"; -ast=$recv($Smalltalk())._parse_(src); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$ShadowingVariableError()); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} +return $Array(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError", -referencedClasses: ["Smalltalk", "ShadowingVariableError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "should:raise:", "visit:"] +source: "collectionClass\x0a\x09^ Array", +referencedClasses: ["Array"], +messageSends: [] }), -$globals.SemanticAnalyzerTest); +$globals.ArrayStreamTest.klass); + +$core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testVariableShadowing3", -protocol: 'tests', +selector: "newCollection", +protocol: 'accessing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. [ | b | b := 2 ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +return "hello world"; + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:"] +source: "newCollection\x0a\x09^ 'hello world'", +referencedClasses: [], +messageSends: [] }), -$globals.SemanticAnalyzerTest); +$globals.StringStreamTest); + $core.addMethod( $core.method({ -selector: "testVariableShadowing4", -protocol: 'tests', +selector: "collectionClass", +protocol: 'accessing', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} +return $String(); + }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:"] +source: "collectionClass\x0a\x09^ String", +referencedClasses: ["String"], +messageSends: [] }), -$globals.SemanticAnalyzerTest); +$globals.StringStreamTest.klass); + +$core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests'); $core.addMethod( $core.method({ -selector: "testVariableShadowing5", +selector: "testCopying", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]"; -ast=$recv($Smalltalk())._parse_(src); -self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$ShadowingVariableError()); +self._assert_equals_(nil._copy(),nil); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError", -referencedClasses: ["Smalltalk", "ShadowingVariableError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "should:raise:", "visit:"] +source: "testCopying\x0a\x09self assert: nil copy equals: nil", +referencedClasses: [], +messageSends: ["assert:equals:", "copy"] }), -$globals.SemanticAnalyzerTest); +$globals.UndefinedTest); $core.addMethod( $core.method({ -selector: "testVariablesLookup", +selector: "testDeepCopy", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28; -src="foo | a | a + 1. [ | b | b := a ]"; -ast=$recv($Smalltalk())._parse_(src); -$recv(self["@analyzer"])._visit_(ast); -$7=$recv(ast)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=2; -//>>excludeEnd("ctx"); -$6=$recv($7)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=2; -//>>excludeEnd("ctx"); -$5=$recv($6)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=1; -//>>excludeEnd("ctx"); -$4=$recv($5)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); -$3=$recv($4)._receiver(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["receiver"]=1; -//>>excludeEnd("ctx"); -$2=$recv($3)._binding(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["binding"]=1; -//>>excludeEnd("ctx"); -$1=$recv($2)._isTempVar(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["isTempVar"]=1; -//>>excludeEnd("ctx"); -self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); -$15=$recv(ast)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=4; -//>>excludeEnd("ctx"); -$14=$recv($15)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=4; -//>>excludeEnd("ctx"); -$13=$recv($14)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=3; -//>>excludeEnd("ctx"); -$12=$recv($13)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=3; -//>>excludeEnd("ctx"); -$11=$recv($12)._receiver(); -$10=$recv($11)._binding(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["binding"]=2; -//>>excludeEnd("ctx"); -$9=$recv($10)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=1; -//>>excludeEnd("ctx"); -$16=$recv(ast)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=2; -//>>excludeEnd("ctx"); -$8=$recv($9).__eq_eq($16); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["=="]=1; -//>>excludeEnd("ctx"); -self._assert_($8); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=2; -//>>excludeEnd("ctx"); -$27=$recv(ast)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=8; -//>>excludeEnd("ctx"); -$26=$recv($27)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=7; -//>>excludeEnd("ctx"); -$25=$recv($26)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=7; -//>>excludeEnd("ctx"); -$24=$recv($25)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last"]=1; -//>>excludeEnd("ctx"); -$23=$recv($24)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=6; -//>>excludeEnd("ctx"); -$22=$recv($23)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=6; -//>>excludeEnd("ctx"); -$21=$recv($22)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=5; -//>>excludeEnd("ctx"); -$20=$recv($21)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=5; -//>>excludeEnd("ctx"); -$19=$recv($20)._left(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["left"]=1; -//>>excludeEnd("ctx"); -$18=$recv($19)._binding(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["binding"]=3; -//>>excludeEnd("ctx"); -$17=$recv($18)._isTempVar(); -self._assert_($17); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["assert:"]=3; -//>>excludeEnd("ctx"); -$39=$recv(ast)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=12; -//>>excludeEnd("ctx"); -$38=$recv($39)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=10; -//>>excludeEnd("ctx"); -$37=$recv($38)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=11; -//>>excludeEnd("ctx"); -$36=$recv($37)._last(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["last"]=2; -//>>excludeEnd("ctx"); -$35=$recv($36)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=10; -//>>excludeEnd("ctx"); -$34=$recv($35)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=9; -//>>excludeEnd("ctx"); -$33=$recv($34)._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=9; -//>>excludeEnd("ctx"); -$32=$recv($33)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["first"]=8; -//>>excludeEnd("ctx"); -$31=$recv($32)._left(); -$30=$recv($31)._binding(); -$29=$recv($30)._scope(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["scope"]=3; -//>>excludeEnd("ctx"); -$42=$recv($recv($recv(ast)._nodes())._first())._nodes(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["nodes"]=13; -//>>excludeEnd("ctx"); -$41=$recv($42)._last(); -$40=$recv($41)._scope(); -$28=$recv($29).__eq_eq($40); -self._assert_($28); +self._assert_($recv(nil._deepCopy()).__eq(nil)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.", -referencedClasses: ["Smalltalk"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"] +source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil", +referencedClasses: [], +messageSends: ["assert:", "=", "deepCopy"] }), -$globals.SemanticAnalyzerTest); - - +$globals.UndefinedTest); -$core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests'); $core.addMethod( $core.method({ -selector: "setUp", -protocol: 'running', +selector: "testIfNil", +protocol: 'tests', fn: function (){ var self=this; -function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)} -function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)} -function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -var $1,$2,$4,$5,$3,$6; -$1=$recv($AISemanticAnalyzer())._on_($Object()); -$2=$1; -$4=$recv($AIContext())._new(); -$recv($4)._defineLocal_("local"); -$recv($4)._localAt_put_("local",(3)); -$5=$recv($4)._yourself(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -$ctx1.sendIdx["yourself"]=1; -//>>excludeEnd("ctx"); -$3=$5; -$recv($2)._context_($3); -$6=$recv($1)._yourself(); -self["@analyzer"]=$6; +var $1,$3,$2,$4,$6,$5,$receiver; +if(($receiver = nil) == null || $receiver.isNil){ +$1=true; +} else { +$1=nil; +}; +self._assert_equals_($1,true); +$ctx1.sendIdx["assert:equals:"]=1; +if(($receiver = nil) == null || $receiver.isNil){ +$3=nil; +} else { +$3=true; +}; +$2=$recv($3).__eq(true); +$ctx1.sendIdx["="]=1; +self._deny_($2); +$ctx1.sendIdx["deny:"]=1; +if(($receiver = nil) == null || $receiver.isNil){ +$4=true; +} else { +$4=false; +}; +self._assert_equals_($4,true); +if(($receiver = nil) == null || $receiver.isNil){ +$6=false; +} else { +$6=true; +}; +$5=$recv($6).__eq(true); +self._deny_($5); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself", -referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"], -//>>excludeEnd("ide"); -messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"] +source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true", +referencedClasses: [], +messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"] }), -$globals.AISemanticAnalyzerTest); +$globals.UndefinedTest); $core.addMethod( $core.method({ -selector: "testContextVariables", +selector: "testIsNil", protocol: 'tests', fn: function (){ var self=this; -var src,ast; -function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); -src="foo | a | local + a"; -ast=$recv($Smalltalk())._parse_(src); -self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); -return $recv(self["@analyzer"])._visit_(ast); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); -}),$UnknownVariableError()); +self._assert_(nil._isNil()); +self._deny_(nil._notNil()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); -}, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)}); -//>>excludeEnd("ctx"); +}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)}); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], -source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError", -referencedClasses: ["Smalltalk", "UnknownVariableError"], -//>>excludeEnd("ide"); -messageSends: ["parse:", "shouldnt:raise:", "visit:"] +source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.", +referencedClasses: [], +messageSends: ["assert:", "isNil", "deny:", "notNil"] }), -$globals.AISemanticAnalyzerTest); +$globals.UndefinedTest); }); @@ -81328,9 +61921,7 @@ $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); } $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "setUp", @@ -81338,21 +61929,15 @@ protocol: 'running', fn: function (){ var self=this; function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@empty"]=$recv($Set())._new(); self["@full"]=$recv($Set())._with_with_((5),"abc"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc", referencedClasses: ["Set"], -//>>excludeEnd("ide"); messageSends: ["new", "with:with:"] }), $globals.ExampleSetTest); @@ -81363,21 +61948,15 @@ selector: "testAdd", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@empty"])._add_((5)); self._assert_($recv(self["@empty"])._includes_((5))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["add:", "assert:", "includes:"] }), $globals.ExampleSetTest); @@ -81388,21 +61967,15 @@ selector: "testGrow", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@empty"])._addAll_((1)._to_((100))); self._assert_equals_($recv(self["@empty"])._size(),(100)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["addAll:", "to:", "assert:equals:", "size"] }), $globals.ExampleSetTest); @@ -81414,40 +61987,24 @@ protocol: 'tests', fn: function (){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@empty"])._at_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),$Error()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["should:raise:"]=1; -//>>excludeEnd("ctx"); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@empty"])._at_put_((5),"abc"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); }),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error", referencedClasses: ["Error"], -//>>excludeEnd("ide"); messageSends: ["should:raise:", "at:", "at:put:"] }), $globals.ExampleSetTest); @@ -81458,29 +62015,19 @@ selector: "testIncludes", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@full"])._includes_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["includes:"]=1; -//>>excludeEnd("ctx"); self._assert_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:"]=1; -//>>excludeEnd("ctx"); self._assert_($recv(self["@full"])._includes_("abc")); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["assert:", "includes:"] }), $globals.ExampleSetTest); @@ -81491,38 +62038,24 @@ selector: "testOccurrences", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv(self["@empty"])._occurrencesOf_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["occurrencesOf:"]=1; -//>>excludeEnd("ctx"); self._assert_equals_($1,(0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); $2=$recv(self["@full"])._occurrencesOf_((5)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["occurrencesOf:"]=2; -//>>excludeEnd("ctx"); self._assert_equals_($2,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["assert:equals:"]=2; -//>>excludeEnd("ctx"); $recv(self["@full"])._add_((5)); self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["assert:equals:", "occurrencesOf:", "add:"] }), $globals.ExampleSetTest); @@ -81533,27 +62066,19 @@ selector: "testRemove", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(self["@full"])._remove_((5)); $1=$recv(self["@full"])._includes_("abc"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["includes:"]=1; -//>>excludeEnd("ctx"); self._assert_($1); self._deny_($recv(self["@full"])._includes_((5))); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["remove:", "assert:", "includes:", "deny:"] }), $globals.ExampleSetTest); @@ -81567,32 +62092,22 @@ selector: "fakeError", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@flag"]="bad"; self._timeout_((30)); self["@flag"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self["@flag"]="ok"; self["@flag"]; return self._error_("Intentional"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((20)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"] }), $globals.SUnitAsyncTest); @@ -81603,30 +62118,20 @@ selector: "fakeErrorFailingInTearDown", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@flag"]="bad"; self._timeout_((30)); self["@flag"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._error_("Intentional"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((20)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"] }), $globals.SUnitAsyncTest); @@ -81637,32 +62142,22 @@ selector: "fakeFailure", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@flag"]="bad"; self._timeout_((30)); self["@flag"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self["@flag"]="ok"; self["@flag"]; return self._assert_(false); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((20)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"] }), $globals.SUnitAsyncTest); @@ -81673,49 +62168,29 @@ selector: "fakeMultipleTimeoutFailing", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; self._timeout_((100)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["timeout:"]=1; -//>>excludeEnd("ctx"); $1=self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._timeout_((20)); return $recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((30)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["async:"]=1; -//>>excludeEnd("ctx"); $recv($1)._valueWithTimeout_((20)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["valueWithTimeout:"]=1; -//>>excludeEnd("ctx"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"] }), $globals.SUnitAsyncTest); @@ -81726,49 +62201,29 @@ selector: "fakeMultipleTimeoutPassing", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; self._timeout_((20)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["timeout:"]=1; -//>>excludeEnd("ctx"); $1=self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._timeout_((40)); return $recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((20)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["async:"]=1; -//>>excludeEnd("ctx"); $recv($1)._valueWithTimeout_((10)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["valueWithTimeout:"]=1; -//>>excludeEnd("ctx"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"] }), $globals.SUnitAsyncTest); @@ -81779,29 +62234,19 @@ selector: "fakeTimeout", protocol: 'helpers', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._timeout_((10)); $recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((20)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"] }), $globals.SUnitAsyncTest); @@ -81812,29 +62257,19 @@ selector: "selectorSetOf:", protocol: 'private', fn: function (aCollection){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv(aCollection)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._asSet(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aCollection"], source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["asSet", "collect:", "selector"] }), $globals.SUnitAsyncTest); @@ -81849,11 +62284,9 @@ self["@flag"]="ok"; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setUp\x0a\x09flag := 'ok'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.SUnitAsyncTest); @@ -81864,20 +62297,14 @@ selector: "tearDown", protocol: 'running', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._assert_equals_("ok",self["@flag"]); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "tearDown\x0a\x09self assert: 'ok' equals: flag", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["assert:equals:"] }), $globals.SUnitAsyncTest); @@ -81891,71 +62318,45 @@ var self=this; var suite,runner,result,assertBlock; function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)} function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4; suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._class())._selector_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); runner=$recv($TestSuiteRunner())._on_(suite); self._timeout_((200)); result=$recv(runner)._result(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["result"]=1; -//>>excludeEnd("ctx"); assertBlock=self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=self._selectorSetOf_($recv(result)._errors()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["selectorSetOf:"]=1; -//>>excludeEnd("ctx"); $2=["fakeError"]._asSet(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["asSet"]=1; -//>>excludeEnd("ctx"); self._assert_equals_($1,$2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet()); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=$recv($recv(ann)._result()).__eq_eq(result); if($core.assert($3)){ $4=$recv($recv(result)._runs()).__eq($recv(result)._total()); return $recv($4)._ifTrue_(assertBlock); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)}); -//>>excludeEnd("ctx"); })); $recv(runner)._run(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run", referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"], -//>>excludeEnd("ide"); messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"] }), $globals.SUnitAsyncTest); @@ -81967,46 +62368,30 @@ protocol: 'tests', fn: function (){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._async_((function(){ })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["async:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),$Error()); self._timeout_((0)); self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._async_((function(){ })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); }),$Error()); self._finished(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished", referencedClasses: ["Error"], -//>>excludeEnd("ide"); messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"] }), $globals.SUnitAsyncTest); @@ -82018,41 +62403,25 @@ protocol: 'tests', fn: function (){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._should_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["finished"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); }),$Error()); self._timeout_((0)); self._shouldnt_raise_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); }),$Error()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.", referencedClasses: ["Error"], -//>>excludeEnd("ide"); messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"] }), $globals.SUnitAsyncTest); @@ -82063,36 +62432,24 @@ selector: "testIsAsyncReturnsCorrectValues", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=self._isAsync(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["isAsync"]=1; -//>>excludeEnd("ctx"); self._deny_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["deny:"]=1; -//>>excludeEnd("ctx"); self._timeout_((0)); $2=self._isAsync(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["isAsync"]=2; -//>>excludeEnd("ctx"); self._assert_($2); self._finished(); self._deny_(self._isAsync()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"] }), $globals.SUnitAsyncTest); @@ -82103,33 +62460,23 @@ selector: "testPass", protocol: 'tests', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@flag"]="bad"; self._timeout_((10)); self["@flag"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._assert_(true); self._finished(); self["@flag"]="ok"; return self["@flag"]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((5)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"] }), $globals.SUnitAsyncTest); @@ -82144,67 +62491,43 @@ var suite,runner,result,assertBlock; function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)} function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)} function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self._class())._selector_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); runner=$recv($TestSuiteRunner())._on_(suite); self._timeout_((200)); result=$recv(runner)._result(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["result"]=1; -//>>excludeEnd("ctx"); assertBlock=self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=self._selectorSetOf_($recv(result)._errors()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["selectorSetOf:"]=1; -//>>excludeEnd("ctx"); self._assert_equals_($1,$recv($Set())._new()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet()); return self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv($recv(ann)._result()).__eq_eq(result); if($core.assert($2)){ $3=$recv($recv(result)._runs()).__eq($recv(result)._total()); return $recv($3)._ifTrue_(assertBlock); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)}); -//>>excludeEnd("ctx"); })); $recv(runner)._run(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run", referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"], -//>>excludeEnd("ide"); messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"] }), $globals.SUnitAsyncTest); @@ -82216,67 +62539,43 @@ protocol: 'tests', fn: function (){ var self=this; var x; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; self["@flag"]="bad"; self._timeout_((10)); x=(0); $1=self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._finished(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["finished"]=1; -//>>excludeEnd("ctx"); self["@flag"]="ok"; self["@flag"]; x=$recv(x).__plus((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["+"]=1; -//>>excludeEnd("ctx"); x; return self._assert_equals_(x,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["assert:equals:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["async:"]=1; -//>>excludeEnd("ctx"); self["@flag"]=$recv($1)._valueWithTimeout_((0)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["valueWithTimeout:"]=1; -//>>excludeEnd("ctx"); self["@flag"]=$recv(self._async_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); self._finished(); self["@flag"]="ok"; self["@flag"]; x=$recv(x).__plus((1)); x; return self._assert_equals_(x,(1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })))._valueWithTimeout_((0)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"] }), $globals.SUnitAsyncTest); @@ -82284,6 +62583,18 @@ $globals.SUnitAsyncTest); }); +define('amber/devel',[ + './helpers', // pre-fetch, dep of ./deploy + './deploy', // pre-fetch, dep of ./lang + './lang', + // --- packages of the development only Amber begin here --- + 'amber_core/SUnit', + 'amber_core/Compiler-Tests', + 'amber_core/Kernel-Tests', + 'amber_core/SUnit-Tests' + // --- packages of the development only Amber end here --- +], function (amber) { return amber; }); + define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){ var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage('AmberCli'); @@ -82291,9 +62602,7 @@ $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); }; $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"}; $core.addClass('AmberCli', $globals.Object, [], 'AmberCli'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ @@ -82302,51 +62611,31 @@ protocol: 'commandline', fn: function (){ var self=this; var switches; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["collect:"]=1; -//>>excludeEnd("ctx"); switches=$recv(switches)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._match_("^[^:]*:$"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); switches=$recv(switches)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); })); $1=switches; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^ switches", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"] }), $globals.AmberCli.klass); @@ -82358,20 +62647,14 @@ protocol: 'commands', fn: function (args){ var self=this; function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv($Configurator())._new())._start(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "config: args\x0a\x09Configurator new start", referencedClasses: ["Configurator"], -//>>excludeEnd("ide"); messageSends: ["start", "new"] }), $globals.AmberCli.klass); @@ -82384,27 +62667,19 @@ fn: function (args){ var self=this; var selector; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(args)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["first"]=1; -//>>excludeEnd("ctx"); selector=self._selectorForCommandLineSwitch_($1); $recv(args)._remove_($recv(args)._first()); self._perform_withArguments_(selector,$recv($Array())._with_(args)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"] }), $globals.AmberCli.klass); @@ -82416,29 +62691,19 @@ protocol: 'commands', fn: function (args){ var self=this; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($Transcript())._show_("Available commands"); $recv(self._commandLineSwitches())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(console)._log_(each); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]", referencedClasses: ["Transcript"], -//>>excludeEnd("ide"); messageSends: ["show:", "do:", "commandLineSwitches", "log:"] }), $globals.AmberCli.klass); @@ -82450,20 +62715,14 @@ protocol: 'commands', fn: function (args){ var self=this; function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv($Initer())._new())._start(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "init: args\x0a\x09Initer new start", referencedClasses: ["Initer"], -//>>excludeEnd("ide"); messageSends: ["start", "new"] }), $globals.AmberCli.klass); @@ -82477,47 +62736,29 @@ var self=this; var args,nodeMinorVersion; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11; $5=$recv($Smalltalk())._version(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["version"]=1; -//>>excludeEnd("ctx"); $4="Welcome to Amber version ".__comma($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); $3=$recv($4).__comma(" (NodeJS "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); $2=$recv($3).__comma($recv($recv(process)._versions())._node()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $1=$recv($2).__comma(")."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($Transcript())._show_($1); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["show:"]=1; -//>>excludeEnd("ctx"); $8=$recv(process)._version(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["version"]=2; -//>>excludeEnd("ctx"); $7=$recv($8)._tokenize_("."); $6=$recv($7)._second(); nodeMinorVersion=$recv($6)._asNumber(); $9=$recv(nodeMinorVersion).__lt((8)); if($core.assert($9)){ $recv($Transcript())._show_("You are currently using Node.js ".__comma($recv(process)._version())); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["show:"]=2; -//>>excludeEnd("ctx"); $recv($Transcript())._show_("Required is at least Node.js v0.8.x or greater."); return (-1); }; @@ -82531,15 +62772,11 @@ $11=self._handleArguments_(args); return $11; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09Transcript show: 'You are currently using Node.js ', (process version).\x0a\x09\x09Transcript show: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]", referencedClasses: ["Transcript", "Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"] }), $globals.AmberCli.klass); @@ -82551,21 +62788,15 @@ protocol: 'commands', fn: function (args){ var self=this; function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($Repl())._new())._createInterface(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "repl: args\x0a\x09^ Repl new createInterface", referencedClasses: ["Repl"], -//>>excludeEnd("ide"); messageSends: ["createInterface", "new"] }), $globals.AmberCli.klass); @@ -82577,20 +62808,14 @@ protocol: 'commandline', fn: function (aSwitch){ var self=this; var command,selector; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; $1=$recv(self._commandLineSwitches())._includes_(aSwitch); if($core.assert($1)){ selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._second())._asUppercase(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); }))).__comma(":"); selector; } else { @@ -82599,15 +62824,11 @@ selector; }; $2=selector; return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aSwitch"], source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^ selector", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"] }), $globals.AmberCli.klass); @@ -82619,21 +62840,15 @@ protocol: 'commands', fn: function (args){ var self=this; function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start(); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["args"], source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start", referencedClasses: ["FileServer"], -//>>excludeEnd("ide"); messageSends: ["start", "createServerWithArguments:"] }), $globals.AmberCli.klass); @@ -82647,11 +62862,9 @@ var self=this; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["arguments"], source: "version: arguments", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.AmberCli.klass); @@ -82664,20 +62877,14 @@ selector: "dirname", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return __dirname; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "dirname\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.BaseFileManipulator); @@ -82688,32 +62895,20 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@path"]=$recv(require)._value_("path"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); self["@fs"]=$recv(require)._value_("fs"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "value:"] }), $globals.BaseFileManipulator); @@ -82724,21 +62919,15 @@ selector: "rootDirname", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@path"])._join_with_(self._dirname(),".."); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "rootDirname\x0a\x09^ path join: self dirname with: '..'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["join:with:", "dirname"] }), $globals.BaseFileManipulator); @@ -82752,27 +62941,17 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize"] }), $globals.Configurator); @@ -82783,33 +62962,23 @@ selector: "start", protocol: 'action', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $receiver; self._writeConfigThenDo_((function(err){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if(($receiver = err) == null || $receiver.isNil){ return $recv(process)._exit(); } else { return $recv(process)._exit_((111)); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"] }), $globals.Configurator); @@ -82820,20 +62989,14 @@ selector: "writeConfigThenDo:", protocol: 'action', fn: function (aBlock){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev/lib/config')\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"] }), $globals.Configurator); @@ -82841,29 +63004,21 @@ $globals.Configurator); $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "base64Decode:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); return (new Buffer(aString, 'base64').toString()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "base64Decode: aString\x0a\x09", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -82874,9 +63029,7 @@ selector: "basePath", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@basePath"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -82885,15 +63038,11 @@ $1=$recv(self._class())._defaultBasePath(); $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "defaultBasePath", "class"] }), $globals.FileServer); @@ -82904,21 +63053,15 @@ selector: "basePath:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self["@basePath"]=aString; self._validateBasePath(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["validateBasePath"] }), $globals.FileServer); @@ -82929,36 +63072,24 @@ selector: "checkDirectoryLayout", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html")); if(!$core.assert($1)){ $recv(console)._warn_("Warning: project directory does not contain index.html."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["warn:"]=1; -//>>excludeEnd("ctx"); $recv(console)._warn_(" You can specify the directory containing index.html with --base-path."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["warn:"]=2; -//>>excludeEnd("ctx"); $recv(console)._warn_(" You can also specify a page to be served by default,"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["warn:"]=3; -//>>excludeEnd("ctx"); $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page."); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: ' You can specify the directory containing index.html with --base-path.'.\x0a\x09\x09console warn: ' You can also specify a page to be served by default,'.\x0a\x09\x09console warn: ' for all paths that do not map to a file, with --fallback-page.'].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"] }), $globals.FileServer); @@ -82974,11 +63105,9 @@ $1=self["@fallbackPage"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "fallbackPage\x0a\x09^ fallbackPage", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -82993,11 +63122,9 @@ self["@fallbackPage"]=aString; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "fallbackPage: aString\x0a\x09fallbackPage := aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83009,16 +63136,12 @@ protocol: 'request handling', fn: function (aRequest,aResponse){ var self=this; var uri,filename; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; uri=$recv(self["@url"])._parse_($recv(aRequest)._url()); filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname()); $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if($core.assert(aBoolean)){ $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory(); if($core.assert($1)){ @@ -83029,20 +63152,14 @@ return self._respondFileNamed_to_(filename,aResponse); } else { return self._respondNotFoundTo_(aResponse); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRequest", "aResponse"], source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := url parse: aRequest url.\x0a\x09filename := path join: self basePath with: uri pathname.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [(fs statSync: filename) isDirectory\x0a\x09\x09\x09\x09ifTrue: [self respondDirectoryNamed: filename from: uri to: aResponse]\x0a\x09\x09\x09\x09ifFalse: [self respondFileNamed: filename to: aResponse]]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"] }), $globals.FileServer); @@ -83053,21 +63170,15 @@ selector: "handleOPTIONSRequest:respondTo:", protocol: 'request handling', fn: function (aRequest,aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Access-Control-Allow-Origin","*","Access-Control-Allow-Methods","GET, PUT, POST, DELETE, OPTIONS","Access-Control-Allow-Headers","Content-Type, Accept","Content-Length",(0),"Access-Control-Max-Age",(10)])); $recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRequest", "aResponse"], source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "end"] }), $globals.FileServer); @@ -83079,9 +63190,7 @@ protocol: 'request handling', fn: function (aRequest,aResponse){ var self=this; var file,stream; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4; $1=self._isAuthenticated_(aRequest); if(!$core.assert($1)){ @@ -83089,83 +63198,49 @@ self._respondAuthenticationRequiredTo_(aResponse); return nil; }; file=".".__comma($recv(aRequest)._url()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); stream=$recv(self["@fs"])._createWriteStream_(file); $recv(stream)._on_do_("error",(function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=console; $3="Error creating WriteStream for file ".__comma(file); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv($2)._warn_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["warn:"]=1; -//>>excludeEnd("ctx"); $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["warn:"]=2; -//>>excludeEnd("ctx"); $recv(console)._warn_(" The exact error is: ".__comma(error)); return self._respondNotCreatedTo_(aResponse); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $recv(stream)._on_do_("close",(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._respondCreatedTo_(aResponse); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=2; -//>>excludeEnd("ctx"); $recv(aRequest)._setEncoding_("utf8"); $recv(aRequest)._on_do_("data",(function(data){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(stream)._write_(data); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=3; -//>>excludeEnd("ctx"); $recv(aRequest)._on_do_("end",(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(stream)._writable(); if($core.assert($4)){ return $recv(stream)._end(); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRequest", "aResponse"], source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^ nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary directory in your project (often /src)?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"] }), $globals.FileServer); @@ -83176,29 +63251,19 @@ selector: "handleRequest:respondTo:", protocol: 'request handling', fn: function (aRequest,aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$4,$3,$5; $2=$recv(aRequest)._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["method"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__eq("PUT"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); if($core.assert($1)){ self._handlePUTRequest_respondTo_(aRequest,aResponse); }; $4=$recv(aRequest)._method(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["method"]=2; -//>>excludeEnd("ctx"); $3=$recv($4).__eq("GET"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=2; -//>>excludeEnd("ctx"); if($core.assert($3)){ self._handleGETRequest_respondTo_(aRequest,aResponse); }; @@ -83207,15 +63272,11 @@ if($core.assert($5)){ self._handleOPTIONSRequest_respondTo_(aRequest,aResponse); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRequest", "aResponse"], source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"] }), $globals.FileServer); @@ -83231,11 +63292,9 @@ $1=self["@host"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "host\x0a\x09^ host", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83250,11 +63309,9 @@ self["@host"]=hostname; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["hostname"], source: "host: hostname\x0a\x09host := hostname", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83265,46 +63322,30 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@http"]=self._require_("http"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["require:"]=1; -//>>excludeEnd("ctx"); self["@util"]=self._require_("util"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["require:"]=2; -//>>excludeEnd("ctx"); self["@url"]=self._require_("url"); $1=self._class(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; -//>>excludeEnd("ctx"); self["@host"]=$recv($1)._defaultHost(); self["@port"]=$recv(self._class())._defaultPort(); self["@username"]=nil; self["@password"]=nil; self["@fallbackPage"]=nil; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09http := self require: 'http'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"] }), $globals.FileServer); @@ -83316,33 +63357,21 @@ protocol: 'private', fn: function (aRequest){ var self=this; var header,token,auth,parts; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver; $2=$recv(self["@username"])._isNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["isNil"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@password"])._isNil(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["and:"]=1; -//>>excludeEnd("ctx"); if($core.assert($1)){ return true; }; $3=$recv($recv(aRequest)._headers())._at_("authorization"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); if(($receiver = $3) == null || $receiver.isNil){ header=""; } else { @@ -83353,9 +63382,7 @@ if($core.assert($4)){ return false; } else { $5=$recv(header)._tokenize_(" "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["tokenize:"]=1; -//>>excludeEnd("ctx"); if(($receiver = $5) == null || $receiver.isNil){ token=""; } else { @@ -83363,30 +63390,20 @@ token=$5; }; token; $6=$recv(token)._at_((2)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:"]=2; -//>>excludeEnd("ctx"); auth=self._base64Decode_($6); auth; parts=$recv(auth)._tokenize_(":"); parts; $9=self["@username"]; $10=$recv(parts)._at_((1)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:"]=3; -//>>excludeEnd("ctx"); $8=$recv($9).__eq($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["="]=1; -//>>excludeEnd("ctx"); $7=$recv($8)._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@password"]).__eq($recv(parts)._at_((2))); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)}); -//>>excludeEnd("ctx"); })); if($core.assert($7)){ return true; @@ -83395,15 +63412,11 @@ return false; }; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aRequest"], source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^ true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^ false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^ true]\x0a\x09\x09\x09ifFalse: [^ false]\x0a\x09].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="] }), $globals.FileServer); @@ -83418,11 +63431,9 @@ self["@password"]=aPassword; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPassword"], source: "password: aPassword\x0a\x09password := aPassword.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83438,11 +63449,9 @@ $1=self["@port"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "port\x0a\x09^ port", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83457,11 +63466,9 @@ self["@port"]=aNumber; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNumber"], source: "port: aNumber\x0a\x09port := aNumber", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83472,21 +63479,15 @@ selector: "require:", protocol: 'private', fn: function (aModuleString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(require)._value_(aModuleString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aModuleString"], source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.FileServer); @@ -83497,23 +63498,17 @@ selector: "respondAuthenticationRequiredTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"])); $recv(aResponse)._write_("Authentication needed"); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: 'Authentication needed';\x0a\x09\x09end.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "write:", "end"] }), $globals.FileServer); @@ -83524,22 +63519,16 @@ selector: "respondCreatedTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"])); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "end"] }), $globals.FileServer); @@ -83550,20 +63539,14 @@ selector: "respondDirectoryNamed:from:to:", protocol: 'request handling', fn: function (aDirname,aUrl,aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$5,$7,$6,$4,$receiver; $2=$recv(aUrl)._pathname(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["pathname"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._endsWith_("/"); if($core.assert($1)){ $3=$recv(aDirname).__comma("index.html"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); self._respondFileNamed_to_($3,aResponse); } else { $5=$recv($recv(aUrl)._pathname()).__comma("/"); @@ -83574,21 +63557,15 @@ $6=""; $6=$7; }; $4=$recv($5).__comma($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); self._respondRedirect_to_($4,aResponse); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDirname", "aUrl", "aResponse"], source: "respondDirectoryNamed: aDirname from: aUrl to: aResponse\x0a\x09(aUrl pathname endsWith: '/')\x0a\x09\x09ifTrue: [self respondFileNamed: aDirname, 'index.html' to: aResponse]\x0a\x09\x09ifFalse: [self respondRedirect: aUrl pathname, '/', (aUrl search ifNil: ['']) to: aResponse]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"] }), $globals.FileServer); @@ -83600,22 +63577,16 @@ protocol: 'request handling', fn: function (aFilename,aResponse){ var self=this; var type,filename; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5; filename=aFilename; $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(ex)._notNil(); if($core.assert($1)){ $2=console; $3=$recv(filename).__comma(" does not exist"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($2)._log_($3); return self._respondNotFoundTo_(aResponse); } else { @@ -83631,20 +63602,14 @@ $recv(aResponse)._write_encoding_(file,"binary"); $5=$recv(aResponse)._end(); return $5; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aFilename", "aResponse"], source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"] }), $globals.FileServer); @@ -83655,23 +63620,17 @@ selector: "respondInternalErrorTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"])); $recv(aResponse)._write_("500 Internal server error"); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "write:", "end"] }), $globals.FileServer); @@ -83682,23 +63641,17 @@ selector: "respondNotCreatedTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"])); $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?"); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the src directory on the server?';\x0a\x09\x09end.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "write:", "end"] }), $globals.FileServer); @@ -83709,14 +63662,10 @@ selector: "respondNotFoundTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$3,$4; $2=self._fallbackPage(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["fallbackPage"]=1; -//>>excludeEnd("ctx"); $1=$recv($2)._isNil(); if(!$core.assert($1)){ $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse); @@ -83724,37 +63673,23 @@ return $3; }; $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"])); $recv(aResponse)._write_("

404 Not found

"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["write:"]=1; -//>>excludeEnd("ctx"); $recv(aResponse)._write_("

Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:

    "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["write:"]=2; -//>>excludeEnd("ctx"); $recv(aResponse)._write_("
  • create an index.html in the served directory.
  • "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["write:"]=3; -//>>excludeEnd("ctx"); $recv(aResponse)._write_("
  • can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.
  • "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["write:"]=4; -//>>excludeEnd("ctx"); $recv(aResponse)._write_("
  • change the directory to be served with the \x22--base-path\x22 option.
  • "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["write:"]=5; -//>>excludeEnd("ctx"); $recv(aResponse)._write_("

"); $4=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '

404 Not found

';\x0a\x09\x09write: '

Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:

    ';\x0a\x09\x09write: '
  • create an index.html in the served directory.
  • ';\x0a\x09\x09write: '
  • can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.
  • ';\x0a\x09\x09write: '
  • change the directory to be served with the \x22--base-path\x22 option.
  • ';\x0a\x09\x09write: '

';\x0a\x09\x09end", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"] }), $globals.FileServer); @@ -83765,22 +63700,16 @@ selector: "respondOKTo:", protocol: 'request handling', fn: function (aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"])); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aResponse"], source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "end"] }), $globals.FileServer); @@ -83791,22 +63720,16 @@ selector: "respondRedirect:to:", protocol: 'request handling', fn: function (aString,aResponse){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString])); $1=$recv(aResponse)._end(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aResponse"], source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["writeHead:options:", "end"] }), $globals.FileServer); @@ -83817,79 +63740,47 @@ selector: "start", protocol: 'starting', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11; self._checkDirectoryLayout(); $1=$recv(self["@http"])._createServer_((function(request,response){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._handleRequest_respondTo_(request,response); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $recv($1)._on_do_("error",(function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=console; $3="Error starting server: ".__comma(error); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $recv($2)._log_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["log:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $recv($1)._on_do_("listening",(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=console; $8=self._host(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["host"]=1; -//>>excludeEnd("ctx"); $7="Starting file server on http://".__comma($8); $6=$recv($7).__comma(":"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); $10=self._port(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["port"]=1; -//>>excludeEnd("ctx"); $9=$recv($10)._asString(); $5=$recv($6).__comma($9); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); return $recv($4)._log_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); })); $11=$recv($1)._listen_host_(self._port(),self._host()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"] }), $globals.FileServer); @@ -83900,21 +63791,15 @@ selector: "startOn:", protocol: 'starting', fn: function (aPort){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); self._port_(aPort); self._start(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aPort"], source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["port:", "start"] }), $globals.FileServer); @@ -83929,11 +63814,9 @@ self["@username"]=aUsername; return self; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aUsername"], source: "username: aUsername\x0a\x09username := aUsername.", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer); @@ -83944,62 +63827,40 @@ selector: "validateBasePath", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver; $1=self["@fs"]; $2=self._basePath(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["basePath"]=1; -//>>excludeEnd("ctx"); $recv($1)._stat_then_($2,(function(err,stat){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if(($receiver = err) == null || $receiver.isNil){ $3=$recv(stat)._isDirectory(); if(!$core.assert($3)){ $4=console; $7=self._basePath(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["basePath"]=2; -//>>excludeEnd("ctx"); $6="Warning: --base-path parameter ".__comma($7); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=2; -//>>excludeEnd("ctx"); $5=$recv($6).__comma(" is not a directory."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=1; -//>>excludeEnd("ctx"); return $recv($4)._warn_($5); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["warn:"]=1; -//>>excludeEnd("ctx"); }; } else { $8=console; $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); return $recv($8)._warn_($9); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","] }), $globals.FileServer); @@ -84010,21 +63871,15 @@ selector: "withBasePath:", protocol: 'private', fn: function (aBaseRelativePath){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBaseRelativePath"], source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["join:with:", "basePath"] }), $globals.FileServer); @@ -84035,20 +63890,14 @@ selector: "writeData:toFileNamed:", protocol: 'private', fn: function (data,aFilename){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(console)._log_(aFilename); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["data", "aFilename"], source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["log:"] }), $globals.FileServer); @@ -84062,54 +63911,32 @@ protocol: 'accessing', fn: function (){ var self=this; var switches; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._selector(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["collect:"]=1; -//>>excludeEnd("ctx"); switches=$recv(switches)._select_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(each)._match_("^[^:]*:$"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); -//>>excludeEnd("ctx"); })); switches=$recv(switches)._collect_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["replace:with:"]=1; -//>>excludeEnd("ctx"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)}); -//>>excludeEnd("ctx"); })); $1=switches; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^ switches", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"] }), $globals.FileServer.klass); @@ -84122,9 +63949,7 @@ fn: function (options){ var self=this; var server,popFront,front,optionName,optionValue,switches; function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11; var $early={}; try { @@ -84138,58 +63963,36 @@ throw $early=[$1]; $2=$recv($recv(options)._size())._even(); if(!$core.assert($2)){ $recv(console)._log_("Using default parameters."); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["log:"]=1; -//>>excludeEnd("ctx"); $3=console; $4="Wrong commandline options or not enough arguments for: ".__comma(options); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($3)._log_($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["log:"]=2; -//>>excludeEnd("ctx"); $5=console; $6="Use any of the following ones: ".__comma(switches); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $recv($5)._log_($6); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["log:"]=3; -//>>excludeEnd("ctx"); $7=server; return $7; }; popFront=(function(args){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); front=$recv(args)._first(); front; $recv(args)._remove_(front); return front; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)}); -//>>excludeEnd("ctx"); }); $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(options)._notEmpty(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)}); -//>>excludeEnd("ctx"); }))._whileTrue_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); optionName=$recv(popFront)._value_(options); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); optionName; optionValue=$recv(popFront)._value_(options); optionValue; @@ -84201,32 +64004,22 @@ return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(o } else { $9=console; $10=$recv(optionName).__comma(" is not a valid commandline option"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx[","]=3; -//>>excludeEnd("ctx"); $recv($9)._log_($10); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["log:"]=4; -//>>excludeEnd("ctx"); return $recv(console)._log_("Use any of the following ones: ".__comma(switches)); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)}); -//>>excludeEnd("ctx"); })); $11=server; return $11; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["options"], source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^ server.", referencedClasses: ["Array"], -//>>excludeEnd("ide"); messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"] }), $globals.FileServer.klass); @@ -84240,11 +64033,9 @@ var self=this; return "./"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultBasePath\x0a\x09^ './'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer.klass); @@ -84258,11 +64049,9 @@ var self=this; return "127.0.0.1"; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultHost\x0a\x09^ '127.0.0.1'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer.klass); @@ -84278,11 +64067,9 @@ $1=$globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","te return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer.klass); @@ -84296,11 +64083,9 @@ var self=this; return (4000); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "defaultPort\x0a\x09^ 4000", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.FileServer.klass); @@ -84313,49 +64098,35 @@ fn: function (){ var self=this; var fileServer,args; function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; var $early={}; try { args=$recv(process)._argv(); $recv(args)._removeFrom_to_((1),(3)); $recv(args)._detect_ifNone_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(each).__eq("--help"); if($core.assert($1)){ return $recv($FileServer())._printHelp(); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); }),(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); fileServer=$recv($FileServer())._createServerWithArguments_(args); fileServer; $2=$recv(fileServer)._start(); throw $early=[$2]; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); -//>>excludeEnd("ctx"); })); return self; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^ fileServer start]", referencedClasses: ["FileServer"], -//>>excludeEnd("ide"); messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"] }), $globals.FileServer.klass); @@ -84366,24 +64137,18 @@ selector: "mimeTypeFor:", protocol: 'accessing', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){ return "text/plain"; })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"] }), $globals.FileServer.klass); @@ -84394,9 +64159,7 @@ selector: "mimeTypes", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1,$receiver; $2=self["@mimeTypes"]; if(($receiver = $2) == null || $receiver.isNil){ @@ -84406,15 +64169,11 @@ $1=self["@mimeTypes"]; $1=$2; }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNil:", "defaultMimeTypes"] }), $globals.FileServer.klass); @@ -84425,36 +64184,22 @@ selector: "printHelp", protocol: 'accessing', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(console)._log_("Available commandline options are:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["log:"]=1; -//>>excludeEnd("ctx"); $recv(console)._log_("--help"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["log:"]=2; -//>>excludeEnd("ctx"); $recv(self._commandLineSwitches())._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(console)._log_($recv(each).__comma(" ")); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' ']", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["log:", "do:", "commandLineSwitches", ","] }), $globals.FileServer.klass); @@ -84465,33 +64210,21 @@ selector: "selectorForCommandLineSwitch:", protocol: 'accessing', fn: function (aSwitch){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(each)._second())._asUppercase(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["replace:with:"]=1; -//>>excludeEnd("ctx"); $1=$recv($2).__comma(":"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aSwitch"], source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^ ((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [",", "replace:with:", "asUppercase", "second"] }), $globals.FileServer.klass); @@ -84505,20 +64238,14 @@ protocol: 'action', fn: function (aBlock){ var self=this; var child; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$4,$3,$2; child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]); $1=child; $recv($1)._on_do_("error",aBlock); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $2=$recv($1)._on_do_("close",(function(code){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(code).__eq((0)); if($core.assert($4)){ $3=nil; @@ -84526,20 +64253,14 @@ $3=nil; $3=code; }; return $recv(aBlock)._value_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="] }), $globals.Initer); @@ -84551,23 +64272,17 @@ protocol: 'action', fn: function (){ var self=this; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(console)._log_([" ", "The project should now be set up.", " ", " ", "To manage project from cli (run tests, recompile),", "the `grunt` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g grunt-cli", " ", "To manage project dependencies,", "the `bower` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g bower", " "]._join_($recv($String())._lf())); $recv((function(){ }))._valueWithTimeout_((600)); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09\x09'To manage project from cli (run tests, recompile),'\x0a\x09\x09'the `grunt` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g grunt-cli'\x0a\x09\x09' '\x0a\x09\x09'To manage project dependencies,'\x0a\x09\x09'the `bower` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g bower'\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["log:", "join:", "lf", "valueWithTimeout:"] }), $globals.Initer); @@ -84579,24 +64294,16 @@ protocol: 'action', fn: function (aBlock){ var self=this; var child,sanitizedTemplatePath; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$4,$3,$2; sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["replace:with:"]=1; -//>>excludeEnd("ctx"); child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]); $1=child; $recv($1)._on_do_("error",aBlock); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $2=$recv($1)._on_do_("close",(function(code){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(code).__eq((0)); if($core.assert($4)){ $3=nil; @@ -84604,20 +64311,14 @@ $3=nil; $3=code; }; return $recv(aBlock)._value_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="] }), $globals.Initer); @@ -84629,20 +64330,14 @@ protocol: 'action', fn: function (aBlock){ var self=this; var child; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$4,$3,$2; child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]); $1=child; $recv($1)._on_do_("error",aBlock); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $2=$recv($1)._on_do_("close",(function(code){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $4=$recv(code).__eq((0)); if($core.assert($4)){ $3=nil; @@ -84650,20 +64345,14 @@ $3=nil; $3=code; }; return $recv(aBlock)._value_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="] }), $globals.Initer); @@ -84674,29 +64363,19 @@ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@childProcess"]=$recv(require)._value_("child_process"); self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["initialize", "value:", "join:with:", "rootDirname"] }), $globals.Initer); @@ -84708,26 +64387,18 @@ protocol: 'action', fn: function (aBlock){ var self=this; var child; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock); $1=$recv(child)._stdout(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["stdout"]=1; -//>>excludeEnd("ctx"); $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false])); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["exec:thenDo:", "pipe:options:", "stdout"] }), $globals.Initer); @@ -84741,23 +64412,17 @@ var self=this; var modulePath,packageJson,binSection,scriptPath; function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)} function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$3,$4,$2,$5,$6; $1=self["@path"]; $3=$recv($JSObjectProxy())._on_(require); $4=$recv(aString).__comma("/package.json"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._resolve_($4); modulePath=$recv($1)._dirname_($2); packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json"))); binSection=$recv(packageJson)._at_("bin"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:"]=1; -//>>excludeEnd("ctx"); $5=$recv(binSection)._isString(); if($core.assert($5)){ scriptPath=binSection; @@ -84766,15 +64431,11 @@ scriptPath=$recv(binSection)._at_(anotherString); }; $6=$recv(self["@path"])._join_with_(modulePath,scriptPath); return $6; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anotherString"], source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath", referencedClasses: ["JSObjectProxy", "Smalltalk"], -//>>excludeEnd("ide"); messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"] }), $globals.Initer); @@ -84785,116 +64446,74 @@ selector: "start", protocol: 'action', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3,$4,$5,$6,$7,$8,$receiver; self._gruntInitThenDo_((function(error){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if(($receiver = error) == null || $receiver.isNil){ return self._bowerInstallThenDo_((function(error2){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); if(($receiver = error2) == null || $receiver.isNil){ return self._npmInstallThenDo_((function(error3){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx4) { -//>>excludeEnd("ctx"); if(($receiver = error3) == null || $receiver.isNil){ return self._gruntThenDo_((function(error4){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx5) { -//>>excludeEnd("ctx"); if(($receiver = error4) == null || $receiver.isNil){ self._finishMessage(); return $recv(process)._exit(); } else { $7=console; $recv($7)._log_("grunt exec error:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx5.sendIdx["log:"]=7; -//>>excludeEnd("ctx"); $8=$recv($7)._log_(error4); $8; return $recv(process)._exit_((104)); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)}); -//>>excludeEnd("ctx"); })); } else { $5=console; $recv($5)._log_("npm install exec error:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx4.sendIdx["log:"]=5; -//>>excludeEnd("ctx"); $6=$recv($5)._log_(error3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx4.sendIdx["log:"]=6; -//>>excludeEnd("ctx"); $6; return $recv(process)._exit_((103)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx4.sendIdx["exit:"]=3; -//>>excludeEnd("ctx"); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)}); -//>>excludeEnd("ctx"); })); } else { $3=console; $recv($3)._log_("bower install exec error:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["log:"]=3; -//>>excludeEnd("ctx"); $4=$recv($3)._log_(error2); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["log:"]=4; -//>>excludeEnd("ctx"); $4; return $recv(process)._exit_((102)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx["exit:"]=2; -//>>excludeEnd("ctx"); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)}); -//>>excludeEnd("ctx"); })); } else { $1=console; $recv($1)._log_("grunt-init exec error:"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["log:"]=1; -//>>excludeEnd("ctx"); $2=$recv($1)._log_(error); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["log:"]=2; -//>>excludeEnd("ctx"); $2; return $recv(process)._exit_((101)); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["exit:"]=1; -//>>excludeEnd("ctx"); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"] }), $globals.Initer); @@ -84902,9 +64521,7 @@ $globals.Initer); $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli'); -//>>excludeStart("ide", pragmas.excludeIdeData); $globals.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing .\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support."; -//>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addVariableNamed:to:", @@ -84912,9 +64529,7 @@ protocol: 'private', fn: function (aString,anObject){ var self=this; var newClass,newObject; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; newClass=self._subclass_withVariable_($recv(anObject)._class(),aString); self._encapsulateVariable_withValue_in_(aString,anObject,newClass); @@ -84922,15 +64537,11 @@ newObject=$recv(newClass)._new(); self._setPreviousVariablesFor_from_(newObject,anObject); $1=newObject; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"] }), $globals.Repl); @@ -84943,15 +64554,11 @@ fn: function (buffer,aBlock){ var self=this; function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)} function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$4,$2,$1,$receiver; $1=self._parseAssignment_do_(buffer,(function(name,expr){ var varName,value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if(($receiver = name) == null || $receiver.isNil){ varName=self._nextResultName(); } else { @@ -84961,9 +64568,7 @@ varName; self["@session"]=self._addVariableNamed_to_(varName,self["@session"]); self["@session"]; $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); $3=$recv(varName).__comma(" := "); if(($receiver = expr) == null || $receiver.isNil){ $4=buffer; @@ -84971,40 +64576,26 @@ $4=buffer; $4=expr; }; $2=$recv($3).__comma($4); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx3.sendIdx[","]=1; -//>>excludeEnd("ctx"); value=self._eval_on_($2,self["@session"]); return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)}); -//>>excludeEnd("ctx"); }))._on_do_($Error(),(function(e){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { -//>>excludeEnd("ctx"); $recv($recv($ConsoleErrorHandler())._new())._logError_(e); value=nil; return value; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)}); -//>>excludeEnd("ctx"); })); return $recv(aBlock)._value_value_(varName,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["buffer", "aBlock"], source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ConsoleErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]", referencedClasses: ["Error", "ConsoleErrorHandler"], -//>>excludeEnd("ide"); messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"] }), $globals.Repl); @@ -85017,31 +64608,21 @@ fn: function (){ var self=this; var esc,cls; function $String(){return $globals.String||(typeof String=="undefined"?nil:String)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; esc=$recv($String())._fromCharCode_((27)); $1=$recv($recv(esc).__comma("[2J")).__comma(esc); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); cls=$recv($1).__comma("[0;0f"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($recv(process)._stdout())._write_(cls); $recv(self["@interface"])._prompt(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt", referencedClasses: ["String"], -//>>excludeEnd("ide"); messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"] }), $globals.Repl); @@ -85052,20 +64633,14 @@ selector: "close", protocol: 'actions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv($recv(process)._stdin())._destroy(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "close\x0a\x09process stdin destroy", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["destroy", "stdin"] }), $globals.Repl); @@ -85081,11 +64656,9 @@ $1=self["@commands"]; return $1; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "commands\x0a\x09^ commands", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Repl); @@ -85096,46 +64669,30 @@ selector: "createInterface", protocol: 'actions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout()); $recv(self["@interface"])._on_do_("line",(function(buffer){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._processLine_(buffer); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["on:do:"]=1; -//>>excludeEnd("ctx"); $recv(self["@interface"])._on_do_("close",(function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._close(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); self._printWelcome(); self._setupHotkeys(); $1=self._setPrompt(); $recv(self["@interface"])._prompt(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"] }), $globals.Repl); @@ -85148,44 +64705,28 @@ fn: function (aString,anObject,aClass){ var self=this; var compiler; function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$4,$3,$2,$5,$6; compiler=$recv($Compiler())._new(); $1=compiler; $4=$recv(aString).__comma(": anObject ^ "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); $3=$recv($4).__comma(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(" := anObject"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($1)._install_forClass_protocol_($2,aClass,"session"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["install:forClass:protocol:"]=1; -//>>excludeEnd("ctx"); $5=compiler; $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=4; -//>>excludeEnd("ctx"); $recv($5)._install_forClass_protocol_($6,aClass,"session"); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject", "aClass"], source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass protocol: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass protocol: 'session'.", referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); messageSends: ["new", "install:forClass:protocol:", ","] }), $globals.Repl); @@ -85197,21 +64738,15 @@ protocol: 'actions', fn: function (buffer){ var self=this; function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=self._eval_on_(buffer,$recv($DoIt())._new()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["buffer"], source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.", referencedClasses: ["DoIt"], -//>>excludeEnd("ide"); messageSends: ["eval:on:", "new"] }), $globals.Repl); @@ -85224,47 +64759,33 @@ fn: function (buffer,anObject){ var self=this; var result; function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$3; $1=$recv(buffer)._isEmpty(); if(!$core.assert($1)){ $recv((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject); return result; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); }))._tryCatch_((function(e){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $2=$recv(e)._isSmalltalkError(); if($core.assert($2)){ return $recv(e)._resignal(); } else { return $recv($recv(process)._stdout())._write_($recv(e)._jsStack()); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)}); -//>>excludeEnd("ctx"); })); }; $3=result; return $3; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["buffer", "anObject"], source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result", referencedClasses: ["Compiler"], -//>>excludeEnd("ide"); messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"] }), $globals.Repl); @@ -85275,37 +64796,27 @@ selector: "executeCommand:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; var $early={}; try { $recv(self._commands())._keysAndValuesDo_((function(names,cmd){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $1=$recv(names)._includes_(aString); if($core.assert($1)){ $recv(cmd)._value(); throw $early=[true]; }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return false; } catch(e) {if(e===$early)return e[0]; throw e} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"] }), $globals.Repl); @@ -85317,34 +64828,22 @@ protocol: 'initialization', fn: function (){ var self=this; function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); ( -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, -//>>excludeEnd("ctx"); $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), [])); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; -//>>excludeEnd("ctx");; self["@session"]=$recv($DoIt())._new(); self["@readline"]=$recv(require)._value_("readline"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["value:"]=1; -//>>excludeEnd("ctx"); self["@util"]=$recv(require)._value_("util"); self._setupCommands(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands", referencedClasses: ["DoIt"], -//>>excludeEnd("ide"); messageSends: ["initialize", "new", "value:", "setupCommands"] }), $globals.Repl); @@ -85355,33 +64854,23 @@ selector: "instanceVariableNamesFor:", protocol: 'private', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$3,$1,$receiver; $2=$recv(aClass)._superclass(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["superclass"]=1; -//>>excludeEnd("ctx"); if(($receiver = $2) == null || $receiver.isNil){ $1=$recv(aClass)._instanceVariableNames(); } else { $3=$recv(aClass)._instanceVariableNames(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["instanceVariableNames"]=1; -//>>excludeEnd("ctx"); $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass())); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"] }), $globals.Repl); @@ -85392,21 +64881,15 @@ selector: "isIdentifier:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp()); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["match:", "asRegexp"] }), $globals.Repl); @@ -85417,21 +64900,15 @@ selector: "isVariableDefined:", protocol: 'private', fn: function (aString){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["includes:", "instanceVariableNamesFor:", "class"] }), $globals.Repl); @@ -85442,9 +64919,7 @@ selector: "nextResultName", protocol: 'private', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2,$receiver; $1=self["@resultCount"]; if(($receiver = $1) == null || $receiver.isNil){ @@ -85454,15 +64929,11 @@ self["@resultCount"]=$recv(self["@resultCount"]).__plus((1)); }; $2="res".__comma($recv(self["@resultCount"])._asString()); return $2; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"] }), $globals.Repl); @@ -85473,32 +64944,22 @@ selector: "onKeyPress:", protocol: 'private', fn: function (key){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv(key)._ctrl())._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv($recv(key)._name()).__eq("l"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); if($core.assert($1)){ self._clearScreen(); }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["key"], source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"] }), $globals.Repl); @@ -85510,50 +64971,32 @@ protocol: 'private', fn: function (aString,aBlock){ var self=this; var assignment; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1; assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(s)._trimBoth(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)}); -//>>excludeEnd("ctx"); })); $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); $3=$recv(assignment)._first(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["first"]=1; -//>>excludeEnd("ctx"); return self._isIdentifier_($3); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); })); if($core.assert($2)){ $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["value:value:"]=1; -//>>excludeEnd("ctx"); } else { $1=$recv(aBlock)._value_value_(nil,nil); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aBlock"], source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [ aBlock value: assignment first value: assignment last ]\x0a\x09\x09ifFalse: [ aBlock value: nil value: nil ]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"] }), $globals.Repl); @@ -85565,35 +65008,23 @@ protocol: 'private', fn: function (varName,value){ var self=this; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$1,$4; $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=3; -//>>excludeEnd("ctx"); $2=$recv($3).__comma(" = "); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=2; -//>>excludeEnd("ctx"); $1=$recv($2).__comma($recv(value)._asString()); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; -//>>excludeEnd("ctx"); $recv($Transcript())._show_($1); $4=$recv($Transcript())._cr(); $recv(self["@interface"])._prompt(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["varName", "value"], source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt", referencedClasses: ["Transcript"], -//>>excludeEnd("ide"); messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"] }), $globals.Repl); @@ -85605,22 +65036,16 @@ protocol: 'actions', fn: function (){ var self=this; function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $recv($Transcript())._show_("Type :q to exit."); $1=$recv($Transcript())._cr(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.", referencedClasses: ["Transcript"], -//>>excludeEnd("ide"); messageSends: ["show:", "cr"] }), $globals.Repl); @@ -85632,18 +65057,12 @@ protocol: 'private', fn: function (buffer){ var self=this; var show; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1,$2; show=(function(varName,value){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return self._presentResultNamed_withValue_(varName,value); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)}); -//>>excludeEnd("ctx"); }); $1=self._executeCommand_(buffer); if(!$core.assert($1)){ @@ -85655,15 +65074,11 @@ self._assignNewVariable_do_(buffer,show); }; }; return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["buffer"], source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"] }), $globals.Repl); @@ -85677,11 +65092,9 @@ var self=this; return "amber >> "; }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "prompt\x0a\x09^ 'amber >> '", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: [] }), $globals.Repl); @@ -85692,28 +65105,18 @@ selector: "setPreviousVariablesFor:from:", protocol: 'private', fn: function (newObject,oldObject){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["newObject", "oldObject"], source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"] }), $globals.Repl); @@ -85724,20 +65127,14 @@ selector: "setPrompt", protocol: 'actions', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self["@interface"])._setPrompt_(self._prompt()); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setPrompt\x0a\x09interface setPrompt: self prompt", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["setPrompt:", "prompt"] }), $globals.Repl); @@ -85749,42 +65146,26 @@ protocol: 'initialization', fn: function (){ var self=this; function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $2,$1; $2=$recv([":q"]).__minus_gt((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(process)._exit(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); -//>>excludeEnd("ctx"); })); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["->"]=1; -//>>excludeEnd("ctx"); $1=[$2,$recv([""]).__minus_gt((function(){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); return $recv(self["@interface"])._prompt(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); -//>>excludeEnd("ctx"); }))]; self["@commands"]=$recv($Dictionary())._from_($1); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}", referencedClasses: ["Dictionary"], -//>>excludeEnd("ide"); messageSends: ["from:", "->", "exit", "prompt"] }), $globals.Repl); @@ -85795,33 +65176,23 @@ selector: "setupHotkeys", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $receiver; $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){ -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { -//>>excludeEnd("ctx"); if(($receiver = key) == null || $receiver.isNil){ return key; } else { return self._onKeyPress_(key); }; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)}); -//>>excludeEnd("ctx"); })); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"] }), $globals.Repl); @@ -85833,21 +65204,15 @@ protocol: 'private', fn: function (aClass,varName){ var self=this; function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $1; $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core"); return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "varName"], source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'", referencedClasses: ["ClassBuilder"], -//>>excludeEnd("ide"); messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"] }), $globals.Repl); @@ -85858,47 +65223,33 @@ selector: "subclassNameFor:", protocol: 'private', fn: function (aClass){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); var $3,$2,$7,$6,$5,$4,$8,$1,$receiver; $3=$recv(aClass)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=1; -//>>excludeEnd("ctx"); $2=$recv($3)._matchesOf_("\x5cd+$"); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["matchesOf:"]=1; -//>>excludeEnd("ctx"); if(($receiver = $2) == null || $receiver.isNil){ $1=$recv($recv(aClass)._name()).__comma("2"); } else { var counter; $7=$recv(aClass)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=2; -//>>excludeEnd("ctx"); $6=$recv($7)._matchesOf_("\x5cd+$"); $5=$recv($6)._first(); $4=$recv($5)._asNumber(); counter=$recv($4).__plus((1)); counter; $8=$recv(aClass)._name(); -//>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["name"]=3; -//>>excludeEnd("ctx"); $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString()); }; return $1; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","] }), $globals.Repl); @@ -85910,29 +65261,303 @@ selector: "main", protocol: 'initialization', fn: function (){ var self=this; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { -//>>excludeEnd("ctx"); $recv(self._new())._createInterface(); return self; -//>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)}); -//>>excludeEnd("ctx"); }, -//>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "main\x0a\x09self new createInterface", referencedClasses: [], -//>>excludeEnd("ide"); messageSends: ["createInterface", "new"] }), $globals.Repl.klass); }); -define("app", ["amber/boot","amber_core/Kernel-Objects","amber_core/Kernel-Classes","amber_core/Kernel-Methods","amber_core/Kernel-Collections","amber_core/Kernel-Infrastructure","amber_core/Kernel-Exceptions","amber_core/Kernel-Announcements","amber_core/Platform-Services","amber_core/Compiler-Exceptions","amber_core/Compiler-Core","amber_core/Compiler-AST","amber_core/Compiler-IR","amber_core/Compiler-Inlining","amber_core/Compiler-Semantic","amber_core/Compiler-Interpreter","amber/parser","amber_core/SUnit","amber_core/Platform-ImportExport","amber_core/Kernel-Tests","amber_core/Compiler-Tests","amber_core/SUnit-Tests","amber_cli/AmberCli"], function (boot) { -boot.api.initialize(); -var $core = boot.api, $globals = boot.globals; -$globals.AmberCli._main(); +(function () { + define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) { + amber.initialize(); + amber.globals.AmberCli._main(); + }); + }()); +require("app"); }); -requirejs(["app"]); +define.require("_wrap_app"); +}((function amdefine(module, requireFn) { + + var defineCache = {}, + loaderCache = {}, + alreadyCalled = false, + path = require('path'), + makeRequire, stringRequire; + + /** + * Trims the . and .. from an array of path segments. + * It will keep a leading path segment if a .. will become + * the first path segment, to help with module name lookups, + * which act like paths, but can be remapped. But the end result, + * all paths that use this function should look normalized. + * NOTE: this method MODIFIES the input array. + * @param {Array} ary the array of path segments. + */ + function trimDots(ary) { + var i, part; + for (i = 0; ary[i]; i+= 1) { + part = ary[i]; + if (part === '.') { + ary.splice(i, 1); + i -= 1; + } else if (part === '..') { + if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { + //End of the line. Keep at least one non-dot + //path segment at the front so it can be mapped + //correctly to disk. Otherwise, there is likely + //no path mapping for a path starting with '..'. + //This can still fail, but catches the most reasonable + //uses of .. + break; + } else if (i > 0) { + ary.splice(i - 1, 2); + i -= 2; + } + } + } + } + + function normalize(name, baseName) { + var baseParts; + + //Adjust any relative paths. + if (name && name.charAt(0) === '.') { + //If have a base name, try to normalize against it, + //otherwise, assume it is a top-level require that will + //be relative to baseUrl in the end. + if (baseName) { + baseParts = baseName.split('/'); + baseParts = baseParts.slice(0, baseParts.length - 1); + baseParts = baseParts.concat(name.split('/')); + trimDots(baseParts); + name = baseParts.join('/'); + } + } + + return name; + } + + /** + * Create the normalize() function passed to a loader plugin's + * normalize method. + */ + function makeNormalize(relName) { + return function (name) { + return normalize(name, relName); + }; + } + + function makeLoad(id) { + function load(value) { + loaderCache[id] = value; + } + + load.fromText = function (id, text) { + //This one is difficult because the text can/probably uses + //define, and any relative paths and requires should be relative + //to that id was it would be found on disk. But this would require + //bootstrapping a module/require fairly deeply from node core. + //Not sure how best to go about that yet. + throw new Error('amdefine does not implement load.fromText'); + }; + + return load; + } + + makeRequire = function (systemRequire, exports, module, relId) { + function amdRequire(deps, callback) { + if (typeof deps === 'string') { + //Synchronous, single module require('') + return stringRequire(systemRequire, exports, module, deps, relId); + } else { + //Array of dependencies with a callback. + + //Convert the dependencies to modules. + deps = deps.map(function (depName) { + return stringRequire(systemRequire, exports, module, depName, relId); + }); + + //Wait for next tick to call back the require call. + process.nextTick(function () { + callback.apply(null, deps); + }); + } + } + + amdRequire.toUrl = function (filePath) { + if (filePath.indexOf('.') === 0) { + return normalize(filePath, path.dirname(module.filename)); + } else { + return filePath; + } + }; + + return amdRequire; + }; + + //Favor explicit value, passed in if the module wants to support Node 0.4. + requireFn = requireFn || function req() { + return module.require.apply(module, arguments); + }; + + function runFactory(id, deps, factory) { + var r, e, m, result; + + if (id) { + e = loaderCache[id] = {}; + m = { + id: id, + uri: __filename, + exports: e + }; + r = makeRequire(requireFn, e, m, id); + } else { + //Only support one define call per file + if (alreadyCalled) { + throw new Error('amdefine with no module ID cannot be called more than once per file.'); + } + alreadyCalled = true; + + //Use the real variables from node + //Use module.exports for exports, since + //the exports in here is amdefine exports. + e = module.exports; + m = module; + r = makeRequire(requireFn, e, m, module.id); + } + + //If there are dependencies, they are strings, so need + //to convert them to dependency values. + if (deps) { + deps = deps.map(function (depName) { + return r(depName); + }); + } + + //Call the factory with the right dependencies. + if (typeof factory === 'function') { + result = factory.apply(m.exports, deps); + } else { + result = factory; + } + + if (result !== undefined) { + m.exports = result; + if (id) { + loaderCache[id] = m.exports; + } + } + } + + stringRequire = function (systemRequire, exports, module, id, relId) { + //Split the ID by a ! so that + var index = id.indexOf('!'), + originalId = id, + prefix, plugin; + + if (index === -1) { + id = normalize(id, relId); + + //Straight module lookup. If it is one of the special dependencies, + //deal with it, otherwise, delegate to node. + if (id === 'require') { + return makeRequire(systemRequire, exports, module, relId); + } else if (id === 'exports') { + return exports; + } else if (id === 'module') { + return module; + } else if (loaderCache.hasOwnProperty(id)) { + return loaderCache[id]; + } else if (defineCache[id]) { + runFactory.apply(null, defineCache[id]); + return loaderCache[id]; + } else { + if(systemRequire) { + return systemRequire(originalId); + } else { + throw new Error('No module with ID: ' + id); + } + } + } else { + //There is a plugin in play. + prefix = id.substring(0, index); + id = id.substring(index + 1, id.length); + + plugin = stringRequire(systemRequire, exports, module, prefix, relId); + + if (plugin.normalize) { + id = plugin.normalize(id, makeNormalize(relId)); + } else { + //Normalize the ID normally. + id = normalize(id, relId); + } + + if (loaderCache[id]) { + return loaderCache[id]; + } else { + plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {}); + + return loaderCache[id]; + } + } + }; + + //Create a define function specific to the module asking for amdefine. + function define(id, deps, factory) { + if (Array.isArray(id)) { + factory = deps; + deps = id; + id = undefined; + } else if (typeof id !== 'string') { + factory = id; + id = deps = undefined; + } + + if (deps && !Array.isArray(deps)) { + factory = deps; + deps = undefined; + } + + if (!deps) { + deps = ['require', 'exports', 'module']; + } + + //Set up properties for this module. If an ID, then use + //internal cache. If no ID, then use the external variables + //for this node module. + if (id) { + //Put the module in deep freeze until there is a + //require call for it. + defineCache[id] = [id, deps, factory]; + } else { + runFactory(id, deps, factory); + } + } + + //define.require, which has access to all the values in the + //cache. Useful for AMD modules that all have IDs in the file, + //but need to finally export a value to node based on one of those + //IDs. + define.require = function (id) { + if (loaderCache[id]) { + return loaderCache[id]; + } + + if (defineCache[id]) { + runFactory.apply(null, defineCache[id]); + return loaderCache[id]; + } + }; + + define.amd = {}; + + return define; +}(module)), require)); \ No newline at end of file