Browse Source

Merge branch 'master' into moka

GNOME-OSTree builder 10 years ago
parent
commit
401c5e1767

+ 3 - 0
API-CHANGES.txt

@@ -1,5 +1,8 @@
 0.12.2:
 
+* Collection >> contains: is deprecated in favor of anySatisfy:
+
+
 + Announcer
   + >>on:doOnce:
 + String

+ 18 - 0
RELEASING.md

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

+ 38 - 0
js/Canvas.js

@@ -2759,6 +2759,44 @@ referencedClasses: []
 }),
 smalltalk.TagBrush);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:",
+category: 'attributes',
+fn: function (aString){
+var self=this;
+function $Collection(){return smalltalk.Collection||(typeof Collection=="undefined"?nil:Collection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_ifAbsent_(aString,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($Collection())._new())._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.TagBrush)})},
+args: ["aString"],
+source: "at: aString\x0a\x09^ self at: aString ifAbsent: [ Collection new errorNotFound ]",
+messageSends: ["at:ifAbsent:", "errorNotFound", "new"],
+referencedClasses: ["Collection"]
+}),
+smalltalk.TagBrush);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+category: 'attributes',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self['@element'].hasAttribute(aString) ? self['@element'].getAttribute(aString) : aBlock._value();
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.TagBrush)})},
+args: ["aString", "aBlock"],
+source: "at: aString ifAbsent: aBlock\x0a\x09<return self['@element'].hasAttribute(aString) ? self['@element'].getAttribute(aString) : aBlock._value()>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.TagBrush);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "at:put:",

+ 4 - 7
js/Compiler-AST.js

@@ -630,20 +630,17 @@ return smalltalk.withContext(function($ctx2) {
 return self._shouldBeInlined();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
 return smalltalk.withContext(function($ctx2) {
-return _st(_st(self._nodes())._detect_ifNone_((function(each){
+return _st(self._nodes())._anySatisfy_((function(each){
 return smalltalk.withContext(function($ctx3) {
 return _st(each)._subtreeNeedsAliasing();
-}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}),(function(){
-return smalltalk.withContext(function($ctx3) {
-return false;
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))).__tild_eq(false);
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
 $ctx1.sendIdx["or:"]=1;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.Node)})},
 args: [],
-source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]",
-messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "~=", "detect:ifNone:", "nodes", "subtreeNeedsAliasing"],
+source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
+messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"],
 referencedClasses: []
 }),
 smalltalk.Node);

+ 1 - 35
js/Kernel-Announcements.js

@@ -367,42 +367,8 @@ referencedClasses: []
 smalltalk.SystemAnnouncer.klass);
 
 
-smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
+smalltalk.addClass('SystemAnnouncement', smalltalk.Object, [], 'Kernel-Announcements');
 smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements";
-smalltalk.addMethod(
-smalltalk.method({
-selector: "theClass",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=self["@theClass"];
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
-args: [],
-source: "theClass\x0a\x09^ theClass",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.SystemAnnouncement);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "theClass:",
-category: 'accessing',
-fn: function (aClass){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-self["@theClass"]=aClass;
-return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
-args: ["aClass"],
-source: "theClass: aClass\x0a\x09theClass := aClass",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.SystemAnnouncement);
-
 
 smalltalk.addMethod(
 smalltalk.method({

+ 9 - 14
js/Kernel-Collections.js

@@ -401,12 +401,13 @@ fn: function (aBlock){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
+self._deprecatedAPI();
 $1=self._anySatisfy_(aBlock);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},smalltalk.Collection)})},
 args: ["aBlock"],
-source: "contains: aBlock\x0a\x09^ self anySatisfy: aBlock",
-messageSends: ["anySatisfy:"],
+source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
+messageSends: ["deprecatedAPI", "anySatisfy:"],
 referencedClasses: []
 }),
 smalltalk.Collection);
@@ -657,24 +658,18 @@ selector: "includes:",
 category: 'testing',
 fn: function (anObject){
 var self=this;
-var sentinel;
-function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-sentinel=_st($Object())._new();
-$1=_st(self._detect_ifNone_((function(each){
+$1=self._anySatisfy_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each).__eq(anObject);
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
-return smalltalk.withContext(function($ctx2) {
-return sentinel;
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__tild_eq(sentinel);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
+}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Collection)})},
 args: ["anObject"],
-source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ (self detect: [ :each | each = anObject ] ifNone: [ sentinel ]) ~= sentinel",
-messageSends: ["new", "~=", "detect:ifNone:", "="],
-referencedClasses: ["Object"]
+source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
+messageSends: ["anySatisfy:", "="],
+referencedClasses: []
 }),
 smalltalk.Collection);
 

+ 8 - 0
st/Canvas.st

@@ -820,6 +820,14 @@ alt: aString
 	self at: 'alt' put: aString
 !
 
+at: aString
+	^ self at: aString ifAbsent: [ Collection new errorNotFound ]
+!
+
+at: aString ifAbsent: aBlock
+	<return self['@element'].hasAttribute(aString) ? self['@element'].getAttribute(aString) : aBlock._value()>
+!
+
 at: aString put: aValue
 	<self['@element'].setAttribute(aString, aValue)>
 !

+ 6 - 6
st/Compiler-AST.st

@@ -48,7 +48,7 @@ nextNode: aNode
 !
 
 nodes
-	^ nodes ifNil: [ nodes := Array new ] 
+	^ nodes ifNil: [ nodes := Array new ]
 !
 
 parent
@@ -168,7 +168,7 @@ stopOnStepping
 
 subtreeNeedsAliasing
 	^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [
-		(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]
+		self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]
 ! !
 
 !Node methodsFor: 'visiting'!
@@ -244,7 +244,7 @@ nextNode: aNode
 !
 
 parameters
-	^ parameters ifNil: [ parameters := Array new ] 
+	^ parameters ifNil: [ parameters := Array new ]
 !
 
 parameters: aCollection
@@ -336,7 +336,7 @@ I represent an JavaScript statement node.!
 !JSStatementNode methodsFor: 'accessing'!
 
 source
-	^ source ifNil: [ '' ] 
+	^ source ifNil: [ '' ]
 !
 
 source: aString
@@ -366,7 +366,7 @@ A method node must be the root and only method node of a valid AST.!
 !MethodNode methodsFor: 'accessing'!
 
 arguments
-	^ arguments ifNil: [ #() ] 
+	^ arguments ifNil: [ #() ]
 !
 
 arguments: aCollection
@@ -480,7 +480,7 @@ I represent an message send node.!
 !SendNode methodsFor: 'accessing'!
 
 arguments
-	^ arguments ifNil: [ arguments := #() ] 
+	^ arguments ifNil: [ arguments := #() ]
 !
 
 arguments: aCollection

+ 1 - 11
st/Kernel-Announcements.st

@@ -157,21 +157,11 @@ new
 ! !
 
 Object subclass: #SystemAnnouncement
-	instanceVariableNames: 'theClass'
+	instanceVariableNames: ''
 	package: 'Kernel-Announcements'!
 !SystemAnnouncement commentStamp!
 I am the superclass of all system announcements!
 
-!SystemAnnouncement methodsFor: 'accessing'!
-
-theClass
-	^ theClass
-!
-
-theClass: aClass
-	theClass := aClass
-! !
-
 !SystemAnnouncement class methodsFor: 'helios'!
 
 heliosClass

+ 3 - 3
st/Kernel-Collections.st

@@ -265,6 +265,8 @@ putOn: aStream
 !Collection methodsFor: 'testing'!
 
 contains: aBlock
+	self deprecatedAPI.
+
 	^ self anySatisfy: aBlock
 !
 
@@ -297,9 +299,7 @@ ifNotEmpty: aBlock ifEmpty: anotherBlock
 !
 
 includes: anObject
-	| sentinel |
-	sentinel := Object new.
-	^ (self detect: [ :each | each = anObject ] ifNone: [ sentinel ]) ~= sentinel
+	^ self anySatisfy: [ :each | each = anObject ]
 !
 
 isEmpty

+ 1 - 12
support/devel.js

@@ -1,7 +1,5 @@
 define([
-	'amber_vm/smalltalk',
-	'./helpers',
-	'jquery',
+	'./deploy',
 	'jquery-ui',
 	'mousewheel',
 	'amber_lib/jquery-tabby/jquery.textarea',
@@ -13,15 +11,6 @@ define([
 	'css!amber_lib/codemirror/addon/hint/show-hint',
 	'css!amber_inc/CodeMirror/amber',
 	'css!amber_css/amber',
-	'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-Transcript',
-	'amber_core/Kernel-Announcements',
-	'amber_core/Canvas',
 	'amber_core/SUnit',
 	'amber_core/Importer-Exporter',
 	'amber_core/Compiler-Exceptions',

+ 1 - 12
support/helios.js

@@ -1,7 +1,5 @@
 define([
-	'amber_vm/smalltalk',
-	'./helpers',
-	'jquery',
+	'./deploy',
 	'jquery-ui',
 	'amber_lib/jquery-tabby/jquery.textarea',
 	'amber_lib/bootstrap/js/bootstrap',
@@ -14,15 +12,6 @@ define([
 	'css!amber_lib/codemirror/addon/hint/show-hint',
 	'css!amber_inc/CodeMirror/amber',
 	'css!amber_css/helios',
-	'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-Transcript',
-	'amber_core/Kernel-Announcements',
-	'amber_core/Canvas',
 	'amber_core/SUnit',
 	'amber_core/Importer-Exporter',
 	'amber_core/Compiler-Exceptions',