resin 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/amber/bin/amberc +4 -3
  2. data/amber/js/IDE.deploy.js +147 -45
  3. data/amber/js/IDE.js +155 -53
  4. data/amber/js/Kernel-Classes.deploy.js +20 -14
  5. data/amber/js/Kernel-Classes.js +29 -18
  6. data/amber/js/Kernel-Collections.deploy.js +82 -0
  7. data/amber/js/Kernel-Collections.js +102 -0
  8. data/amber/js/Kernel-Methods.deploy.js +374 -261
  9. data/amber/js/Kernel-Methods.js +417 -269
  10. data/amber/js/Kernel-Objects.deploy.js +90 -28
  11. data/amber/js/Kernel-Objects.js +121 -34
  12. data/amber/js/Kernel-Tests.deploy.js +35 -0
  13. data/amber/js/Kernel-Tests.js +45 -0
  14. data/amber/js/SUnit.deploy.js +175 -17
  15. data/amber/js/SUnit.js +237 -24
  16. data/amber/js/amber.js +2 -1
  17. data/amber/js/boot.js +74 -18
  18. data/amber/js/lib/es5-shim-2.0.2/CHANGES +93 -0
  19. data/amber/js/lib/es5-shim-2.0.2/CONTRIBUTORS.md +25 -0
  20. data/amber/js/lib/es5-shim-2.0.2/LICENSE +19 -0
  21. data/amber/js/lib/es5-shim-2.0.2/README.md +161 -0
  22. data/amber/js/lib/es5-shim-2.0.2/es5-sham.js +348 -0
  23. data/amber/js/lib/es5-shim-2.0.2/es5-sham.min.js +6 -0
  24. data/amber/js/lib/es5-shim-2.0.2/es5-shim.js +963 -0
  25. data/amber/js/lib/es5-shim-2.0.2/es5-shim.min.js +16 -0
  26. data/amber/js/lib/es5-shim-2.0.2/minify +2 -0
  27. data/amber/js/lib/es5-shim-2.0.2/package.json +31 -0
  28. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-kill.js +59 -0
  29. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-matchers.js +34 -0
  30. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h.js +3 -0
  31. data/amber/js/lib/es5-shim-2.0.2/tests/index.html +62 -0
  32. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine-html.js +190 -0
  33. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.css +166 -0
  34. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.js +2477 -0
  35. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine_favicon.png +0 -0
  36. data/amber/js/lib/es5-shim-2.0.2/tests/lib/json2.js +478 -0
  37. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-array.js +1138 -0
  38. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-date.js +117 -0
  39. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-function.js +147 -0
  40. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-object.js +84 -0
  41. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-string.js +24 -0
  42. data/amber/st/IDE.st +15 -16
  43. data/amber/st/Kernel-Classes.st +9 -9
  44. data/amber/st/Kernel-Collections.st +37 -0
  45. data/amber/st/Kernel-Methods.st +63 -8
  46. data/amber/st/Kernel-Objects.st +34 -7
  47. data/amber/st/Kernel-Tests.st +10 -0
  48. data/amber/st/SUnit.st +86 -9
  49. metadata +44 -21
  50. data/amber/js/compat.js +0 -22
@@ -56,7 +56,8 @@ amber = (function() {
56
56
  }
57
57
 
58
58
  loadDependencies();
59
- addJSToLoad('compat.js');
59
+ addJSToLoad('lib/es5-shim-2.0.2/es5-shim.min.js');
60
+ addJSToLoad('lib/es5-shim-2.0.2/es5-sham.min.js');
60
61
  addJSToLoad('boot.js');
61
62
 
62
63
  if (deploy) {
@@ -33,7 +33,7 @@
33
33
  |
34
34
  ==================================================================== */
35
35
 
36
- /* Make that console is defined */
36
+ /* Make sure that console is defined */
37
37
 
38
38
  if (typeof console === "undefined") {
39
39
  this.console = {
@@ -47,19 +47,42 @@ if (typeof console === "undefined") {
47
47
 
48
48
  /* Smalltalk constructors definition */
49
49
 
50
- function SmalltalkObject(){}
51
- function SmalltalkBehavior(){}
52
- function SmalltalkClass(){}
53
- function SmalltalkPackage(){}
50
+ function SmalltalkObject(){};
51
+ function SmalltalkBehavior(){};
52
+ function SmalltalkClass(){};
53
+ function SmalltalkPackage(){};
54
54
  function SmalltalkMetaclass(){
55
55
  this.meta = true;
56
- }
57
- function SmalltalkMethod(){}
58
- function SmalltalkNil(){}
56
+ };
57
+ function SmalltalkMethod(){};
58
+ function SmalltalkNil(){};
59
59
 
60
60
  function SmalltalkSymbol(string){
61
61
  this.value = string;
62
- }
62
+ };
63
+
64
+ function SmalltalkOrganizer() {
65
+ this.elements = [];
66
+ };
67
+
68
+ SmalltalkOrganizer.prototype.addElement = function(el) {
69
+ if(typeof el === 'undefined' || el === nil) {
70
+ return false;
71
+ }
72
+ if(this.elements.indexOf(el) == -1) {
73
+ this.elements.push(el);
74
+ }
75
+ };
76
+
77
+ SmalltalkOrganizer.prototype.removeElement = function(el) {
78
+ for(var i=0; i<this.elements.length; i++) {
79
+ if(this.elements[i] == el) {
80
+ this.elements.splice(i, 1);
81
+ break;
82
+ }
83
+ }
84
+ };
85
+
63
86
 
64
87
  function Smalltalk(){
65
88
 
@@ -108,6 +131,7 @@ function Smalltalk(){
108
131
  function pkg(spec) {
109
132
  var that = new SmalltalkPackage();
110
133
  that.pkgName = spec.pkgName;
134
+ that.organization = new SmalltalkOrganizer();
111
135
  that.properties = spec.properties || {};
112
136
  return that;
113
137
  };
@@ -131,7 +155,7 @@ function Smalltalk(){
131
155
  }
132
156
 
133
157
  function metaclass() {
134
- var meta = setupClass(new SmalltalkMetaclass(), {});
158
+ var meta = setupClass(new SmalltalkMetaclass(), {})
135
159
  meta.instanceClass = new meta.fn;
136
160
  return meta;
137
161
  }
@@ -143,6 +167,7 @@ function Smalltalk(){
143
167
  value: function() { return 'Smalltalk ' + this.className; },
144
168
  configurable: true // no writable - in par with ES6 methods
145
169
  });
170
+ that.organization = new SmalltalkOrganizer();
146
171
  that.pkg = spec.pkg;
147
172
  Object.defineProperties(that.fn.prototype, {
148
173
  methods: { value: {}, enumerable: false, configurable: true, writable: true },
@@ -320,9 +345,16 @@ function Smalltalk(){
320
345
  iVarNames: iVarNames
321
346
  });
322
347
  }
348
+
349
+ pkg.organization.addElement(st[className]);
323
350
  };
324
351
 
325
- /* Add a method to a class */
352
+ st.removeClass = function(klass) {
353
+ klass.pkg.organization.removeElement(klass);
354
+ delete st[klass.className];
355
+ };
356
+
357
+ /* Add/remove a method to/from a class */
326
358
 
327
359
  st.addMethod = function(jsSelector, method, klass) {
328
360
  Object.defineProperty(klass.fn.prototype, jsSelector, {
@@ -331,8 +363,31 @@ function Smalltalk(){
331
363
  klass.fn.prototype.methods[method.selector] = method;
332
364
  method.methodClass = klass;
333
365
  method.jsSelector = jsSelector;
366
+
367
+ klass.organization.addElement(method.category);
334
368
  };
335
369
 
370
+ st.removeMethod = function(method) {
371
+ var protocol = method.category;
372
+ var klass = method.methodClass;
373
+ var methods = klass.fn.prototype.methods;
374
+
375
+ delete klass.fn.prototype[method.selector._asSelector()];
376
+ delete methods[method.selector];
377
+
378
+ var selectors = Object.keys(methods);
379
+ var shouldDeleteProtocol = true;
380
+ for(var i= 0, l = selectors.length; i<l; i++) {
381
+ if(methods[selectors[i]].category === protocol) {
382
+ shouldDeleteProtocol = false;
383
+ break;
384
+ };
385
+ };
386
+ if(shouldDeleteProtocol) {
387
+ klass.organization.removeElement(protocol)
388
+ };
389
+ };
390
+
336
391
  /* Handles unhandled errors during message sends */
337
392
 
338
393
  st.send = function(receiver, selector, args, klass) {
@@ -514,7 +569,7 @@ function Smalltalk(){
514
569
 
515
570
  /* Boolean assertion */
516
571
  st.assert = function(boolean) {
517
- if(boolean.klass === smalltalk.Boolean) {
572
+ if ((undefined !== boolean) && (boolean.klass === smalltalk.Boolean)) {
518
573
  return boolean;
519
574
  } else {
520
575
  smalltalk.NonBooleanReceiver._new()._object_(boolean)._signal();
@@ -528,12 +583,6 @@ function SmalltalkMethodContext(receiver, selector, method, temps, home) {
528
583
  this.method = method;
529
584
  this.temps = temps || {};
530
585
  this.homeContext = home;
531
-
532
- this.resume = function() {
533
- //Brutally set the receiver as thisContext, then re-enter the function
534
- smalltalk.thisContext = this;
535
- return this.method.apply(receiver, temps);
536
- };
537
586
  };
538
587
 
539
588
  SmalltalkMethodContext.prototype.copy = function() {
@@ -548,6 +597,12 @@ SmalltalkMethodContext.prototype.copy = function() {
548
597
  );
549
598
  };
550
599
 
600
+ SmalltalkMethodContext.prototype.resume = function() {
601
+ //Brutally set the receiver as thisContext, then re-enter the function
602
+ smalltalk.thisContext = this;
603
+ return this.method.apply(receiver, temps);
604
+ };
605
+
551
606
  /* Global Smalltalk objects. */
552
607
 
553
608
  var nil = new SmalltalkNil();
@@ -570,6 +625,7 @@ smalltalk.wrapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Objec
570
625
  smalltalk.wrapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
571
626
  smalltalk.wrapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
572
627
  smalltalk.wrapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
628
+ smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object);
573
629
 
574
630
  smalltalk.Object.klass.superclass = smalltalk.Class;
575
631
 
@@ -0,0 +1,93 @@
1
+
2
+ 2.0.0
3
+ - Separate reliable shims from dubious shims (shams).
4
+
5
+ 1.2.10
6
+ - Group-effort Style Cleanup
7
+ - Took a stab at fixing Object.defineProperty on IE8 without
8
+ bad side-effects. (@hax)
9
+ - Object.isExtensible no longer fakes it. (@xavierm)
10
+ - Date.prototype.toISOString no longer deals with partial
11
+ ISO dates, per spec (@kitcambridge)
12
+ - More (mostly from @bryanforbes)
13
+
14
+ 1.2.9
15
+ - Corrections to toISOString by @kitcambridge
16
+ - Fixed three bugs in array methods revealed by Jasmine tests.
17
+ - Cleaned up Function.prototype.bind with more fixes and tests from
18
+ @bryanforbes.
19
+
20
+ 1.2.8
21
+ - Actually fixed problems with Function.prototype.bind, and regressions
22
+ from 1.2.7 (@bryanforbes, @jdalton #36)
23
+
24
+ 1.2.7 - REGRESSED
25
+ - Fixed problems with Function.prototype.bind when called as a constructor.
26
+ (@jdalton #36)
27
+
28
+ 1.2.6
29
+ - Revised Date.parse to match ES 5.1 (kitcambridge)
30
+
31
+ 1.2.5
32
+ - Fixed a bug for padding it Date..toISOString (tadfisher issue #33)
33
+
34
+ 1.2.4
35
+ - Fixed a descriptor bug in Object.defineProperty (raynos)
36
+
37
+ 1.2.3
38
+ - Cleaned up RequireJS and <script> boilerplate
39
+
40
+ 1.2.2
41
+ - Changed reduce to follow the letter of the spec with regard to having and
42
+ owning properties.
43
+ - Fixed a bug where RegExps pass as Functions in some engines in reduce.
44
+
45
+ 1.2.1
46
+ - Adding few fixes to make jshint happy.
47
+ - Fix for issue #12, function expressions can cause scoping issues in IE.
48
+ - NPM will minify on install or when `npm run-script install` is executed.
49
+ - Adding .gitignore to avoid publishing dev dependencies.
50
+
51
+ 1.2.0
52
+ - Making script loadable as AMD module.
53
+ - Adding `indexOf` to the list of safe shims.
54
+
55
+ 1.1.0
56
+ - Added support for accessor properties where possible (which is all browsers
57
+ except IE).
58
+ - Stop exposing bound function's (that are returned by
59
+ `Function.prototype.bind`) internal properties (`bound, boundTo, boundArgs`)
60
+ as in some cases (when using facade objects for example) capabilities of the
61
+ enclosed functions will be leaked.
62
+ - `Object.create` now explicitly sets `__proto__` property to guarantee
63
+ correct behavior of `Object.getPrototypeOf`'s on all objects created using
64
+ `Object.create`.
65
+ - Switched to `===` from `==` where possible as it's slightly faster on older
66
+ browsers that are target of this lib.
67
+ - Added names to all anonymous functions to have a better stack traces.
68
+
69
+ 1.0.0
70
+ - fixed Date.toISODate, using UTC accessors, as in
71
+ http://code.google.com/p/v8/source/browse/trunk/src/date.js?r=6120#986
72
+ (arian)
73
+
74
+ 0.0.4
75
+ - Revised Object.getPrototypeOf to work in more cases
76
+ in response to http://ejohn.org/blog/objectgetprototypeof/
77
+ [issue #2] (fschaefer)
78
+
79
+ 0.0.3
80
+ - Fixed typos in Object.keys (samsonjs)
81
+
82
+ 0.0.2
83
+ Per kangax's recommendations:
84
+ - faster Object.create(null)
85
+ - fixed a function-scope function declaration statement in Object.create
86
+
87
+ 0.0.1
88
+ - fixed Object.create(null), in so far as that's possible
89
+ - reworked Rhino Object.freeze(Function) bug detector and patcher
90
+
91
+ 0.0.0
92
+ - forked from narwhal-lib
93
+
@@ -0,0 +1,25 @@
1
+
2
+ - kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
3
+ - tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal
4
+ Project)
5
+ - dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
6
+ - fschaefer Florian Schäfer Copyright (C) 2010 MIT License
7
+ - Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
8
+ - kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
9
+ - kossnocorp Sasha Koss XXX TODO License or CLA
10
+ - bryanforbes Bryan Forbes XXX TODO License or CLA
11
+ - killdream Quildreen Motta Copyright (C) 2011 MIT Licence
12
+ - michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD
13
+ License
14
+ - sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
15
+ - bbqsrc Brendan Molloy (C) 2011 Creative Commons Zero (public domain)
16
+ - iwyg XXX TODO License or CLA
17
+ - DomenicDenicola Domenic Denicola Copyright (C) 2011 MIT License
18
+ - xavierm02 Montillet Xavier Copyright (C) 2011 MIT License
19
+ - Raynos Jake Verbaten Copyright (C) 2011 MIT Licence
20
+ - samsonjs Sami Samhuri Copyright (C) 2010 MIT License
21
+ - rwldrn Rick Waldron Copyright (C) 2011 MIT License
22
+ - lexer Alexey Zakharov XXX TODO License or CLA
23
+ - 280 North Inc. (Now Motorola LLC, a subsidiary of Google Inc.)
24
+ Copyright (C) 2009 MIT License
25
+
@@ -0,0 +1,19 @@
1
+
2
+ Copyright 2009, 2010 Kristopher Michael Kowal. All rights reserved.
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
@@ -0,0 +1,161 @@
1
+
2
+ `es5-shim.js` and `es5-shim.min.js` monkey-patch a JavaScript context to
3
+ contain all EcmaScript 5 methods that can be faithfully emulated with a
4
+ legacy JavaScript engine.
5
+
6
+ `es5-sham.js` and `es5-sham.min.js` monkey-patch other ES5 methods as
7
+ closely as possible. For these methods, as closely as possible to ES5
8
+ is not very close. Many of these shams are intended only to allow code
9
+ to be written to ES5 without causing run-time errors in older engines.
10
+ In many cases, this means that these shams cause many ES5 methods to
11
+ silently fail. Decide carefully whether this is what you want.
12
+
13
+
14
+ ## Tests
15
+
16
+ The tests are written with the Jasmine BDD test framework.
17
+ To run the tests, navigate to <root-folder>/tests/.
18
+
19
+ In order to run against the shim-code, the tests attempt to kill the current
20
+ implementation of the missing methods. This happens in <root-folder>/tests/helpers/h-kill.js.
21
+ So in order to run the tests against the build-in methods, invalidate that file somehow
22
+ (comment-out, delete the file, delete the script-tag, etc.).
23
+
24
+ ## Shims
25
+
26
+ ### Complete tests ###
27
+
28
+ * Array.prototype.every
29
+ * Array.prototype.filter
30
+ * Array.prototype.forEach
31
+ * Array.prototype.indexOf
32
+ * Array.prototype.lastIndexOf
33
+ * Array.prototype.map
34
+ * Array.prototype.some
35
+ * Array.prototype.reduce
36
+ * Array.prototype.reduceRight
37
+ * Array.isArray
38
+ * Date.now
39
+ * Date.prototype.toJSON
40
+ * Function.prototype.bind
41
+ * /!\ Caveat: the bound function's length is always 0.
42
+ * /!\ Caveat: the bound function has a prototype property.
43
+ * /!\ Caveat: bound functions do not try too hard to keep you
44
+ from manipulating their ``arguments`` and ``caller`` properties.
45
+ * /!\ Caveat: bound functions don't have checks in ``call`` and
46
+ ``apply`` to avoid executing as a constructor.
47
+ * Object.keys
48
+ * String.prototype.trim
49
+
50
+ ### Untested ###
51
+
52
+ * Date.parse (for ISO parsing)
53
+ * Date.prototype.toISOString
54
+
55
+ ## Shams
56
+
57
+ * /?\ Object.create
58
+
59
+ For the case of simply "begetting" an object that
60
+ inherits prototypically from another, this should work
61
+ fine across legacy engines.
62
+
63
+ /!\ Object.create(null) will work only in browsers that
64
+ support prototype assignment. This creates an object
65
+ that does not have any properties inherited from
66
+ Object.prototype. It will silently fail otherwise.
67
+
68
+ /!\ The second argument is passed to
69
+ Object.defineProperties which will probably fail
70
+ silently.
71
+
72
+ * /?\ Object.getPrototypeOf
73
+
74
+ This will return "undefined" in some cases. It uses
75
+ __proto__ if it's available. Failing that, it uses
76
+ constructor.prototype, which depends on the constructor
77
+ property of the object's prototype having not been
78
+ replaced. If your object was created like this, it
79
+ won't work:
80
+
81
+ function Foo() {
82
+ }
83
+ Foo.prototype = {};
84
+
85
+ Because the prototype reassignment destroys the
86
+ constructor property.
87
+
88
+ This will work for all objects that were created using
89
+ `Object.create` implemented with this library.
90
+
91
+ * /!\ Object.getOwnPropertyNames
92
+
93
+ This method uses Object.keys, so it will not be accurate
94
+ on legacy engines.
95
+
96
+ * Object.isSealed
97
+
98
+ Returns "false" in all legacy engines for all objects,
99
+ which is conveniently guaranteed to be accurate.
100
+
101
+ * Object.isFrozen
102
+
103
+ Returns "false" in all legacy engines for all objects,
104
+ which is conveniently guaranteed to be accurate.
105
+
106
+ * Object.isExtensible
107
+
108
+ Works like a charm, by trying very hard to extend the
109
+ object then redacting the extension.
110
+
111
+ ### Fail silently
112
+
113
+ * /!\ Object.getOwnPropertyDescriptor
114
+
115
+ The behavior of this shim does not conform to ES5. It
116
+ should probably not be used at this time, until its
117
+ behavior has been reviewed and been confirmed to be
118
+ useful in legacy engines.
119
+
120
+ * /!\ Object.defineProperty
121
+
122
+ This method will silently fail to set "writable",
123
+ "enumerable", and "configurable" properties.
124
+
125
+ Providing a getter or setter with "get" or "set" on a
126
+ descriptor will silently fail on engines that lack
127
+ "__defineGetter__" and "__defineSetter__", which include
128
+ all versions of IE up to version 8 so far.
129
+
130
+ IE 8 provides a version of this method but it only works
131
+ on DOM objects. Thus, the shim will not get installed
132
+ and attempts to set "value" properties will fail
133
+ silently on non-DOM objects.
134
+
135
+ https://github.com/kriskowal/es5-shim/issues#issue/5
136
+
137
+ * /!\ Object.defineProperties
138
+
139
+ This uses the Object.defineProperty shim
140
+
141
+ * Object.seal
142
+
143
+ Silently fails on all legacy engines. This should be
144
+ fine unless you are depending on the safety and security
145
+ provisions of this method, which you cannot possibly
146
+ obtain in legacy engines.
147
+
148
+ * Object.freeze
149
+
150
+ Silently fails on all legacy engines. This should be
151
+ fine unless you are depending on the safety and security
152
+ provisions of this method, which you cannot possibly
153
+ obtain in legacy engines.
154
+
155
+ * Object.preventExtensions
156
+
157
+ Silently fails on all legacy engines. This should be
158
+ fine unless you are depending on the safety and security
159
+ provisions of this method, which you cannot possibly
160
+ obtain in legacy engines.
161
+