Browse Source

Convert spaces to tabs in .st

Herbert Vojčík 11 years ago
parent
commit
8d0d0adde2

+ 46 - 46
st/Benchfib.st

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

+ 166 - 166
st/Canvas.st

@@ -6,61 +6,61 @@ Object subclass: #HTMLCanvas
 !HTMLCanvas methodsFor: 'accessing'!
 
 root
-    ^root
+	^root
 !
 
 root: aTagBrush
-    root := aTagBrush
+	root := aTagBrush
 !
 
 snippet: anElement
 	"Adds clone of anElement, finds [data-snippet=""*""] subelement
-    and returns TagBrush as if that subelement was just added.
-    
-    Rarely needed to use directly, use `html foo` dynamically installed method
-    for a snippet named foo."
-    
-    | clone caret |
-    
-    clone := anElement asJQuery clone.
-    self with: (TagBrush fromJQuery: clone canvas: self).
-    caret := clone find: '[data-snippet="*"]'.
-    caret toArray isEmpty ifTrue: [ caret := clone ].
-    ^TagBrush fromJQuery: (caret removeAttr: 'data-snippet') canvas: self
+	and returns TagBrush as if that subelement was just added.
+	
+	Rarely needed to use directly, use `html foo` dynamically installed method
+	for a snippet named foo."
+	
+	| clone caret |
+	
+	clone := anElement asJQuery clone.
+	self with: (TagBrush fromJQuery: clone canvas: self).
+	caret := clone find: '[data-snippet="*"]'.
+	caret toArray isEmpty ifTrue: [ caret := clone ].
+	^TagBrush fromJQuery: (caret removeAttr: 'data-snippet') canvas: self
 ! !
 
 !HTMLCanvas methodsFor: 'adding'!
 
 entity: aString
 	"Adds a character representing html entity, eg.
-    html entity: 'copy'
-    adds a copyright sign.
-    If a name does not represent valid HTML entity, error is raised."
+	html entity: 'copy'
+	adds a copyright sign.
+	If a name does not represent valid HTML entity, error is raised."
 	| result |
-    result := ('<span />' asJQuery html: '&', aString, ';') text.
-    result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].
-    self with: result
+	result := ('<span />' asJQuery html: '&', aString, ';') text.
+	result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].
+	self with: result
 !
 
 with: anObject
-    ^self root with: anObject
+	^self root with: anObject
 ! !
 
 !HTMLCanvas methodsFor: 'initialization'!
 
 initialize
-    super initialize.
-    root ifNil: [root := TagBrush fromString: 'div' canvas: self]
+	super initialize.
+	root ifNil: [root := TagBrush fromString: 'div' canvas: self]
 !
 
 initializeFromJQuery: aJQuery
-    root := TagBrush fromJQuery: aJQuery canvas: self
+	root := TagBrush fromJQuery: aJQuery canvas: self
 ! !
 
 !HTMLCanvas methodsFor: 'tags'!
 
 a
-    ^self tag: 'a'
+	^self tag: 'a'
 !
 
 abbr
@@ -76,7 +76,7 @@ area
 !
 
 article
-    ^self tag: 'article'
+	^self tag: 'article'
 !
 
 aside
@@ -84,7 +84,7 @@ aside
 !
 
 audio
-    ^self tag: 'audio'
+	^self tag: 'audio'
 !
 
 base
@@ -100,11 +100,11 @@ body
 !
 
 br
-    ^self tag: 'br'
+	^self tag: 'br'
 !
 
 button
-    ^self tag: 'button'
+	^self tag: 'button'
 !
 
 canvas
@@ -120,7 +120,7 @@ cite
 !
 
 code
-    ^self tag: 'code'
+	^self tag: 'code'
 !
 
 col
@@ -152,11 +152,11 @@ details
 !
 
 div
-    ^self tag: 'div'
+	^self tag: 'div'
 !
 
 div: aBlock
-    ^self div with: aBlock
+	^self div with: aBlock
 !
 
 dl
@@ -176,7 +176,7 @@ embed
 !
 
 fieldset
-    ^self tag: 'fieldset'
+	^self tag: 'fieldset'
 !
 
 figcaption
@@ -188,59 +188,59 @@ figure
 !
 
 footer
-    ^self tag: 'footer'
+	^self tag: 'footer'
 !
 
 form
-    ^self tag: 'form'
+	^self tag: 'form'
 !
 
 h1
-    ^self tag: 'h1'
+	^self tag: 'h1'
 !
 
 h1: anObject
-    ^self h1 with: anObject
+	^self h1 with: anObject
 !
 
 h2
-    ^self tag: 'h2'
+	^self tag: 'h2'
 !
 
 h2: anObject
-    ^ self h2 with: anObject
+	^ self h2 with: anObject
 !
 
 h3
-    ^self tag: 'h3'
+	^self tag: 'h3'
 !
 
 h3: anObject
-    ^self h3 with: anObject
+	^self h3 with: anObject
 !
 
 h4
-    ^self tag: 'h4'
+	^self tag: 'h4'
 !
 
 h4: anObject
-    ^self h4 with: anObject
+	^self h4 with: anObject
 !
 
 h5
-    ^self tag: 'h5'
+	^self tag: 'h5'
 !
 
 h5: anObject
-    ^self h5 with: anObject
+	^self h5 with: anObject
 !
 
 h6
-    ^self tag: 'h6'
+	^self tag: 'h6'
 !
 
 h6: anObject
-    ^self h6 with: anObject
+	^self h6 with: anObject
 !
 
 head
@@ -248,7 +248,7 @@ head
 !
 
 header
-    ^self tag: 'header'
+	^self tag: 'header'
 !
 
 hgroup
@@ -256,7 +256,7 @@ hgroup
 !
 
 hr
-    ^self tag: 'hr'
+	^self tag: 'hr'
 !
 
 html
@@ -264,23 +264,23 @@ html
 !
 
 iframe
-    ^self tag: 'iframe'
+	^self tag: 'iframe'
 !
 
 iframe: aString
-    ^self iframe src: aString
+	^self iframe src: aString
 !
 
 img
-    ^self tag: 'img'
+	^self tag: 'img'
 !
 
 img: aString
-    ^self img src: aString
+	^self img src: aString
 !
 
 input
-    ^self tag: 'input'
+	^self tag: 'input'
 !
 
 label
@@ -292,15 +292,15 @@ legend
 !
 
 li
-    ^self tag: 'li'
+	^self tag: 'li'
 !
 
 li: anObject
-    ^self li with: anObject
+	^self li with: anObject
 !
 
 link
-    ^self tag: 'link'
+	^self tag: 'link'
 !
 
 map
@@ -324,7 +324,7 @@ nav
 !
 
 newTag: aString
-    ^TagBrush fromString: aString canvas: self
+	^TagBrush fromString: aString canvas: self
 !
 
 noscript
@@ -336,11 +336,11 @@ object
 !
 
 ol
-    ^self tag: 'ol'
+	^self tag: 'ol'
 !
 
 ol: anObject
-    ^self ol with: anObject
+	^self ol with: anObject
 !
 
 optgroup
@@ -348,7 +348,7 @@ optgroup
 !
 
 option
-    ^self tag: 'option'
+	^self tag: 'option'
 !
 
 output
@@ -356,11 +356,11 @@ output
 !
 
 p
-    ^self tag: 'p'
+	^self tag: 'p'
 !
 
 p: anObject
-    ^self p with: anObject
+	^self p with: anObject
 !
 
 param
@@ -368,7 +368,7 @@ param
 !
 
 pre
-    ^self tag: 'pre'
+	^self tag: 'pre'
 !
 
 progress
@@ -376,15 +376,15 @@ progress
 !
 
 script
-    ^self tag: 'script'
+	^self tag: 'script'
 !
 
 section
-    ^self tag: 'section'
+	^self tag: 'section'
 !
 
 select
-    ^self tag: 'select'
+	^self tag: 'select'
 !
 
 small
@@ -396,11 +396,11 @@ source
 !
 
 span
-    ^self tag: 'span'
+	^self tag: 'span'
 !
 
 span: anObject
-    ^self span with: anObject
+	^self span with: anObject
 !
 
 strong
@@ -412,7 +412,7 @@ strong: anObject
 !
 
 style
-	^ root addBrush:  (StyleTag canvas: self)
+	^ root addBrush: (StyleTag canvas: self)
 !
 
 style: aString
@@ -432,35 +432,35 @@ sup
 !
 
 table
-    ^self tag: 'table'
+	^self tag: 'table'
 !
 
 tag: aString
-    ^root addBrush: (self newTag: aString)
+	^root addBrush: (self newTag: aString)
 !
 
 tbody
-    ^self tag: 'tbody'
+	^self tag: 'tbody'
 !
 
-td 
-    ^self tag: 'td'
+td
+	^self tag: 'td'
 !
 
 textarea
-    ^self tag: 'textarea'
+	^self tag: 'textarea'
 !
 
 tfoot
-    ^self tag: 'tfoot'
+	^self tag: 'tfoot'
 !
 
 th
-    ^self tag: 'th'
+	^self tag: 'th'
 !
 
 thead
-    ^self tag: 'thead'
+	^self tag: 'thead'
 !
 
 time
@@ -472,19 +472,19 @@ title
 !
 
 tr
-    ^self tag: 'tr'
+	^self tag: 'tr'
 !
 
 ul
-    ^self tag: 'ul'
+	^self tag: 'ul'
 !
 
 ul: anObject
-    ^self ul with: anObject
+	^self ul with: anObject
 !
 
 video
-    ^self tag: 'video'
+	^self tag: 'video'
 ! !
 
 !HTMLCanvas class methodsFor: 'instance creation'!
@@ -571,23 +571,23 @@ snippets
 
 initializeFromJQuery: aJQuery
 	"Finds and takes out all snippets out of aJQuery.
-    Installs it into self."
-    
+	Installs it into self."
+	
 	(self snippetsFromJQuery: aJQuery) do: [ :each |
-    	self installSnippetFromJQuery: each asJQuery ]
+		self installSnippetFromJQuery: each asJQuery ]
 ! !
 
 !HTMLSnippet methodsFor: 'method generation'!
 
 snippetAt: aString compile: anElement
 	"Method generation for the snippet.
-    The selector is aString, the method block uses anElement"
-    
-    ClassBuilder new
-    	installMethod: ([ :htmlReceiver | htmlReceiver snippet: anElement ] 
-        	currySelf asCompiledMethod: aString)
-        forClass: HTMLCanvas
-        category: '**snippets'
+	The selector is aString, the method block uses anElement"
+	
+	ClassBuilder new
+		installMethod: ([ :htmlReceiver | htmlReceiver snippet: anElement ]
+			currySelf asCompiledMethod: aString)
+		forClass: HTMLCanvas
+		category: '**snippets'
 ! !
 
 !HTMLSnippet methodsFor: 'private'!
@@ -600,20 +600,20 @@ snippetsFromJQuery: aJQuery
 
 installSnippetFromJQuery: element
 	| name |
-    name := element attr: 'data-snippet'.
-    name = '*' ifFalse: [
-    	('^\*' asRegexp test: name) 
-            ifTrue: [ 
-            	name := name allButFirst. 
-                element attr: 'data-snippet' put: '*' ]
-          	ifFalse: [ 
-            	element removeAttr: 'data-snippet' ].
-        self snippetAt: name install: (element detach get: 0) ]
+	name := element attr: 'data-snippet'.
+	name = '*' ifFalse: [
+		('^\*' asRegexp test: name)
+			ifTrue: [
+				name := name allButFirst.
+				element attr: 'data-snippet' put: '*' ]
+			ifFalse: [
+				element removeAttr: 'data-snippet' ].
+		self snippetAt: name install: (element detach get: 0) ]
 !
 
 snippetAt: aString install: anElement
 	self snippets at: aString put: anElement.
-    self snippetAt: aString compile: anElement
+	self snippetAt: aString compile: anElement
 ! !
 
 HTMLSnippet class instanceVariableNames: 'current'!
@@ -621,15 +621,15 @@ HTMLSnippet class instanceVariableNames: 'current'!
 !HTMLSnippet class methodsFor: 'initialization'!
 
 ensureCurrent
-	current ifNil: [ 
-    	current := super new
+	current ifNil: [
+		current := super new
 			initializeFromJQuery: document asJQuery;
 			yourself ]
 !
 
 initialize
 	super initialize.
-    self isDOMAvailable ifTrue: [
+	self isDOMAvailable ifTrue: [
 		self ensureCurrent ]
 ! !
 
@@ -654,50 +654,50 @@ Object subclass: #TagBrush
 !TagBrush methodsFor: 'accessing'!
 
 element
-    ^element
+	^element
 ! !
 
 !TagBrush methodsFor: 'adding'!
 
 addBrush: aTagBrush
-    self appendChild: aTagBrush element.
-    ^aTagBrush
+	self appendChild: aTagBrush element.
+	^aTagBrush
 !
 
 append: anObject
-    anObject appendToBrush: self
+	anObject appendToBrush: self
 !
 
 appendBlock: aBlock
-    | root |
-    root := canvas root.
-    canvas root: self.
-    aBlock value: canvas.
-    canvas root: root
+	| root |
+	root := canvas root.
+	canvas root: self.
+	aBlock value: canvas.
+	canvas root: root
 !
 
 appendChild: anElement
-	"In IE7 and IE8 appendChild fails on several node types. So we need to check" 
- 	<var element=self['@element'];
- 	if (null == element.canHaveChildren || element.canHaveChildren) {
+	"In IE7 and IE8 appendChild fails on several node types. So we need to check"
+	<var element=self['@element'];
+	if (null == element.canHaveChildren || element.canHaveChildren) {
 		element.appendChild(anElement);
- 	} else {
- 		element.text = String(element.text) +  anElement.innerHTML;
- 	} >
+	} else {
+		element.text = String(element.text) + anElement.innerHTML;
+	} >
 !
 
 appendString: aString
-    self appendChild: (self createTextNodeFor: aString)
+	self appendChild: (self createTextNodeFor: aString)
 !
 
 appendToBrush: aTagBrush
-    aTagBrush addBrush: self
+	aTagBrush addBrush: self
 !
 
 contents: anObject
-    self 
+	self
 	empty;
-   	append: anObject
+	append: anObject
 !
 
 empty
@@ -705,7 +705,7 @@ empty
 !
 
 with: anObject
-    self append: anObject
+	self append: anObject
 ! !
 
 !TagBrush methodsFor: 'attributes'!
@@ -727,11 +727,11 @@ alt: aString
 !
 
 at: aString put: aValue
-    <self['@element'].setAttribute(aString, aValue)>
+	<self['@element'].setAttribute(aString, aValue)>
 !
 
 class: aString
-      <self['@element'].className = aString>
+	<self['@element'].className = aString>
 !
 
 cols: aString
@@ -755,7 +755,7 @@ for: aString
 !
 
 height: aString
-    self  at: 'height' put: aString
+	self at: 'height' put: aString
 !
 
 hidden
@@ -763,15 +763,15 @@ hidden
 !
 
 href: aString
-    self at: 'href' put: aString
+	self at: 'href' put: aString
 !
 
 id: aString
-    self at: 'id' put: aString
+	self at: 'id' put: aString
 !
 
 media: aString
-    self at: 'media' put: aString
+	self at: 'media' put: aString
 !
 
 method: aString
@@ -787,11 +787,11 @@ placeholder: aString
 !
 
 rel: aString
-    self  at: 'rel' put: aString
+	self at: 'rel' put: aString
 !
 
 removeAt: aString
-    <self['@element'].removeAttribute(aString)>
+	<self['@element'].removeAttribute(aString)>
 !
 
 rows: aString
@@ -799,11 +799,11 @@ rows: aString
 !
 
 src: aString
-    self  at: 'src' put: aString
+	self at: 'src' put: aString
 !
 
 style: aString
-    self at: 'style' put: aString
+	self at: 'style' put: aString
 !
 
 tabindex: aNumber
@@ -815,11 +815,11 @@ target: aString
 !
 
 title: aString
-    self at: 'title' put: aString
+	self at: 'title' put: aString
 !
 
 type: aString
-    self at: 'type' put: aString
+	self at: 'type' put: aString
 !
 
 valign: aString
@@ -827,31 +827,31 @@ valign: aString
 !
 
 value: aString
-    self  at: 'value' put: aString
+	self at: 'value' put: aString
 !
 
 width: aString
-    self  at: 'width' put: aString
+	self at: 'width' put: aString
 ! !
 
 !TagBrush methodsFor: 'converting'!
 
 asJQuery
-    ^window jQuery: self element
+	^window jQuery: self element
 ! !
 
 !TagBrush methodsFor: 'events'!
 
 onBlur: aBlock
-    self asJQuery bind: 'blur' do: aBlock
+	self asJQuery bind: 'blur' do: aBlock
 !
 
 onChange: aBlock
-    self asJQuery bind: 'change' do: aBlock
+	self asJQuery bind: 'change' do: aBlock
 !
 
 onClick: aBlock
-    self asJQuery bind: 'click' do: aBlock
+	self asJQuery bind: 'click' do: aBlock
 !
 
 onDblClick: aBlock
@@ -859,7 +859,7 @@ onDblClick: aBlock
 !
 
 onFocus: aBlock
-    self asJQuery bind: 'focus' do: aBlock
+	self asJQuery bind: 'focus' do: aBlock
 !
 
 onFocusIn: aBlock
@@ -875,15 +875,15 @@ onHover: aBlock
 !
 
 onKeyDown: aBlock
-    self asJQuery bind: 'keydown' do: aBlock
+	self asJQuery bind: 'keydown' do: aBlock
 !
 
 onKeyPress: aBlock
-    self asJQuery bind: 'keypress' do: aBlock
+	self asJQuery bind: 'keypress' do: aBlock
 !
 
 onKeyUp: aBlock
-    self asJQuery bind: 'keyup' do: aBlock
+	self asJQuery bind: 'keyup' do: aBlock
 !
 
 onMouseDown: aBlock
@@ -929,13 +929,13 @@ onUnload: aBlock
 !TagBrush methodsFor: 'initialization'!
 
 initializeFromJQuery: aJQuery canvas: aCanvas
-    element := aJQuery get: 0.
-    canvas := aCanvas
+	element := aJQuery get: 0.
+	canvas := aCanvas
 !
 
 initializeFromString: aString canvas: aCanvas
-    element := self createElementFor: aString.
-    canvas := aCanvas
+	element := self createElementFor: aString.
+	canvas := aCanvas
 ! !
 
 !TagBrush methodsFor: 'private'!
@@ -951,13 +951,13 @@ createTextNodeFor: aString
 !TagBrush class methodsFor: 'instance creation'!
 
 fromJQuery: aJQuery canvas: aCanvas
-    ^self new
+	^self new
 	initializeFromJQuery: aJQuery canvas: aCanvas;
 	yourself
 !
 
 fromString: aString canvas: aCanvas
-    ^self new
+	^self new
 	initializeFromString: aString canvas: aCanvas;
 	yourself
 ! !
@@ -981,7 +981,7 @@ with: aString
 !StyleTag class methodsFor: 'instance creation'!
 
 canvas: aCanvas
-    ^self new
+	^self new
 	initializeFromString: 'style' canvas: aCanvas;
 	yourself
 ! !
@@ -993,37 +993,37 @@ Object subclass: #Widget
 !Widget methodsFor: 'adding'!
 
 appendToBrush: aTagBrush
-    self appendToJQuery: aTagBrush asJQuery
+	self appendToJQuery: aTagBrush asJQuery
 !
 
 appendToJQuery: aJQuery
-   self renderOn: (HTMLCanvas onJQuery: aJQuery)
+	self renderOn: (HTMLCanvas onJQuery: aJQuery)
 ! !
 
 !Widget methodsFor: 'rendering'!
 
 renderOn: html
-    self
+	self
 ! !
 
 !Object methodsFor: '*Canvas'!
 
 appendToBrush: aTagBrush
-    aTagBrush append: self asString
+	aTagBrush append: self asString
 !
 
 appendToJQuery: aJQuery
-    aJQuery append: self asString
+	aJQuery append: self asString
 ! !
 
 !BlockClosure methodsFor: '*Canvas'!
 
 appendToBrush: aTagBrush
-    aTagBrush appendBlock: self
+	aTagBrush appendBlock: self
 !
 
 appendToJQuery: aJQuery
-    self value: (HTMLCanvas onJQuery: aJQuery)
+	self value: (HTMLCanvas onJQuery: aJQuery)
 ! !
 
 !CharacterArray methodsFor: '*Canvas'!
@@ -1035,20 +1035,20 @@ asSnippet
 !String methodsFor: '*Canvas'!
 
 appendToBrush: aTagBrush
-    aTagBrush appendString: self
+	aTagBrush appendString: self
 !
 
 appendToJQuery: aJQuery
-    aJQuery append: self
+	aJQuery append: self
 !
 
 asJQuery
-    <return jQuery(String(self))>
+	<return jQuery(String(self))>
 ! !
 
 !JSObjectProxy methodsFor: '*Canvas'!
 
 asJQuery
-    <return jQuery(self['@jsObject'])>
+	<return jQuery(self['@jsObject'])>
 ! !
 

+ 16 - 16
st/Compiler-AST.st

@@ -82,8 +82,8 @@ isValueNode
 !
 
 subtreeNeedsAliasing
-    ^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [
-        (self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]
+	^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [
+		(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]
 ! !
 
 !Node methodsFor: 'visiting'!
@@ -159,7 +159,7 @@ isBlockNode
 !
 
 subtreeNeedsAliasing
-    ^ self shouldBeAliased or: [ self shouldBeInlined ]
+	^ self shouldBeAliased or: [ self shouldBeInlined ]
 ! !
 
 !BlockNode methodsFor: 'visiting'!
@@ -343,13 +343,13 @@ arguments: aCollection
 cascadeNodeWithMessages: aCollection
 	| first |
 	first := SendNode new
-	    selector: self selector;
-	    arguments: self arguments;
-	    yourself.
+		selector: self selector;
+		arguments: self arguments;
+		yourself.
 	^CascadeNode new
-	    receiver: self receiver;
-	    nodes: (Array with: first), aCollection;
-	    yourself
+		receiver: self receiver;
+		nodes: (Array with: first), aCollection;
+		yourself
 !
 
 index
@@ -392,12 +392,12 @@ superSend: aBoolean
 
 valueForReceiver: anObject
 	^SendNode new
-	    receiver: (self receiver 
+		receiver: (self receiver
 		ifNil: [anObject]
 		ifNotNil: [self receiver valueForReceiver: anObject]);
-	    selector: self selector;
-	    arguments: self arguments;
-	    yourself
+		selector: self selector;
+		arguments: self arguments;
+		yourself
 ! !
 
 !SendNode methodsFor: 'testing'!
@@ -438,9 +438,9 @@ temps: aCollection
 
 asBlockSequenceNode
 	^BlockSequenceNode new
-	    nodes: self nodes;
-	    temps: self temps;
-	    yourself
+		nodes: self nodes;
+		temps: self temps;
+		yourself
 ! !
 
 !SequenceNode methodsFor: 'visiting'!

+ 13 - 13
st/Compiler-Core.st

@@ -5,7 +5,7 @@ Object subclass: #Compiler
 !Compiler commentStamp!
 I provide the public interface for compiling Amber source code into JavaScript.
 
-The code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`. 
+The code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.
 The default code generator is an instance of `InlinedCodeGenerator`!
 
 !Compiler methodsFor: 'accessing'!
@@ -89,8 +89,8 @@ evaluateExpression: aString
 evaluateExpression: aString on: anObject
 	"Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object"
 	| result method |
-    method := self eval: (self compileExpression: aString on: anObject).
-    method category: 'xxxDoIt'.
+	method := self eval: (self compileExpression: aString on: anObject).
+	method category: 'xxxDoIt'.
 	anObject class addCompiledMethod: method.
 	result := anObject xxxDoIt.
 	anObject class removeCompiledMethod: method.
@@ -98,18 +98,18 @@ evaluateExpression: aString on: anObject
 !
 
 install: aString forClass: aBehavior category: anotherString
-   	^ ClassBuilder new
-    	installMethod: (self eval: (self compile: aString forClass: aBehavior))
-        forClass: aBehavior
-        category: anotherString
+	^ ClassBuilder new
+		installMethod: (self eval: (self compile: aString forClass: aBehavior))
+		forClass: aBehavior
+		category: anotherString
 !
 
 parse: aString
-    ^Smalltalk current parse: aString
+	^Smalltalk current parse: aString
 !
 
 parseExpression: aString
-    ^self parse: 'doIt ^[', aString, '] value'
+	^self parse: 'doIt ^[', aString, '] value'
 !
 
 recompile: aClass
@@ -229,11 +229,11 @@ I am the abstract super class of all code generators and provide their common AP
 
 classNameFor: aClass
 	^aClass isMetaclass
-	    ifTrue: [aClass instanceClass name, '.klass']
-	    ifFalse: [
+		ifTrue: [aClass instanceClass name, '.klass']
+		ifFalse: [
 		aClass isNil
-		    ifTrue: ['nil']
-		    ifFalse: [aClass name]]
+			ifTrue: ['nil']
+			ifFalse: [aClass name]]
 !
 
 currentClass

+ 2 - 2
st/Compiler-Exceptions.st

@@ -9,7 +9,7 @@ CompilerError subclass: #ParseError
 	instanceVariableNames: ''
 	package: 'Compiler-Exceptions'!
 !ParseError commentStamp!
-Instance of ParseError are signaled on any parsing error. 
+Instance of ParseError are signaled on any parsing error.
 See `Smalltalk >> #parse:`!
 
 CompilerError subclass: #SemanticError
@@ -105,6 +105,6 @@ basicSignal: anError
 
 handleError: anError
 	super handleError: anError.
-    self basicSignal: anError
+	self basicSignal: anError
 ! !
 

+ 123 - 123
st/Compiler-IR.st

@@ -62,8 +62,8 @@ alias: aNode
 
 	aNode isImmutable ifTrue: [ ^ self visit: aNode ].
 
-	variable := IRVariable new 
-		variable: (AliasVar new name: '$', self nextAlias); 
+	variable := IRVariable new
+		variable: (AliasVar new name: '$', self nextAlias);
 		yourself.
 
 	self sequence add: (IRAssignment new
@@ -78,32 +78,32 @@ alias: aNode
 
 aliasTemporally: aCollection
 	"https://github.com/NicolasPetton/amber/issues/296
-    
-    If a node is aliased, all preceding ones are aliased as well.
-    The tree is iterated twice. First we get the aliasing dependency, 
-    then the aliasing itself is done"
+	
+	If a node is aliased, all preceding ones are aliased as well.
+	The tree is iterated twice. First we get the aliasing dependency,
+	then the aliasing itself is done"
 
 	| threshold result |
-    threshold := 0.
-    
-    aCollection withIndexDo: [ :each :i |
-        each subtreeNeedsAliasing
-		    ifTrue: [ threshold := i ]].
+	threshold := 0.
+	
+	aCollection withIndexDo: [ :each :i |
+		each subtreeNeedsAliasing
+			ifTrue: [ threshold := i ]].
 
 	result := OrderedCollection new.
-	aCollection withIndexDo: [ :each :i | 
+	aCollection withIndexDo: [ :each :i |
 		result add: (i <= threshold
 			ifTrue: [ self alias: each ]
 			ifFalse: [ self visit: each ])].
 
-    ^result
+	^result
 !
 
 visitAssignmentNode: aNode
 	| left right assignment |
 	right := self visit: aNode right.
 	left := self visit: aNode left.
-	self sequence add: (IRAssignment new 
+	self sequence add: (IRAssignment new
 		add: left;
 		add: right;
 		yourself).
@@ -117,9 +117,9 @@ visitBlockNode: aNode
 		scope: aNode scope;
 		yourself.
 	aNode scope temps do: [ :each |
-		closure add: (IRTempDeclaration new 
+		closure add: (IRTempDeclaration new
 			name: each name;
-            scope: aNode scope;
+			scope: aNode scope;
 			yourself) ].
 	aNode nodes do: [ :each | closure add: (self visit: each) ].
 	^ closure
@@ -128,11 +128,11 @@ visitBlockNode: aNode
 visitBlockSequenceNode: aNode
 	^ self
 		withSequence: IRBlockSequence new
-		do: [ 
+		do: [
 			aNode nodes ifNotEmpty: [
-				aNode nodes allButLast do: [ :each | 
+				aNode nodes allButLast do: [ :each |
 					self sequence add: (self visit: each) ].
-				aNode nodes last isReturnNode 
+				aNode nodes last isReturnNode
 					ifFalse: [ self sequence add: (IRBlockReturn new add: (self visit: aNode nodes last); yourself) ]
 					ifTrue: [ self sequence add: (self visit: aNode nodes last) ]]]
 !
@@ -140,7 +140,7 @@ visitBlockSequenceNode: aNode
 visitCascadeNode: aNode
 	| alias |
 
-	aNode receiver isImmutable ifFalse: [ 
+	aNode receiver isImmutable ifFalse: [
 		alias := self alias: aNode receiver.
 		aNode nodes do: [ :each |
 			each receiver: (VariableNode new binding: alias variable) ]].
@@ -161,7 +161,7 @@ visitDynamicArrayNode: aNode
 visitDynamicDictionaryNode: aNode
 	| dictionary |
 	dictionary := IRDynamicDictionary new.
-    (self aliasTemporally: aNode nodes) do: [:each | dictionary add: each].
+	(self aliasTemporally: aNode nodes) do: [:each | dictionary add: each].
 	^ dictionary
 !
 
@@ -175,11 +175,11 @@ visitMethodNode: aNode
 
 	self method: (IRMethod new
 		source: self source;
-        theClass: self theClass;
+		theClass: self theClass;
 		arguments: aNode arguments;
 		selector: aNode selector;
 		messageSends: aNode messageSends;
-        superSends: aNode superSends;
+		superSends: aNode superSends;
 		classReferences: aNode classReferences;
 		scope: aNode scope;
 		yourself).
@@ -187,7 +187,7 @@ visitMethodNode: aNode
 	aNode scope temps do: [ :each |
 		self method add: (IRTempDeclaration new
 			name: each name;
-            scope: aNode scope;
+			scope: aNode scope;
 			yourself) ].
 
 	aNode nodes do: [ :each | self method add: (self visit: each) ].
@@ -202,7 +202,7 @@ visitMethodNode: aNode
 
 visitReturnNode: aNode
 	| return |
-	return := aNode nonLocalReturn 
+	return := aNode nonLocalReturn
 		ifTrue: [ IRNonLocalReturn new ]
 		ifFalse: [ IRReturn new ].
 	return scope: aNode scope.
@@ -214,12 +214,12 @@ visitReturnNode: aNode
 visitSendNode: aNode
 	| send all receiver arguments |
 	send := IRSend new.
-	send 
+	send
 		selector: aNode selector;
 		index: aNode index.
 	aNode superSend ifTrue: [ send classSend: self theClass superclass ].
-    
-    all := self aliasTemporally: { aNode receiver }, aNode arguments.
+	
+	all := self aliasTemporally: { aNode receiver }, aNode arguments.
 	receiver := all first.
 	arguments := all allButFirst.
 
@@ -230,8 +230,8 @@ visitSendNode: aNode
 !
 
 visitSequenceNode: aNode
-	^ self 
-		withSequence: IRSequence new 	
+	^ self
+		withSequence: IRSequence new	
 		do: [
 			aNode nodes do: [ :each | | instruction |
 				instruction := self visit: each.
@@ -240,14 +240,14 @@ visitSequenceNode: aNode
 !
 
 visitValueNode: aNode
-	^ IRValue new 
-		value: aNode value; 
+	^ IRValue new
+		value: aNode value;
 		yourself
 !
 
 visitVariableNode: aNode
-	^ IRVariable new 
-		variable: aNode binding; 
+	^ IRVariable new
+		variable: aNode binding;
 		yourself
 ! !
 
@@ -293,7 +293,7 @@ remove: anIRInstruction
 
 replace: anIRInstruction with: anotherIRInstruction
 	anotherIRInstruction parent: self.
-	self instructions 
+	self instructions
 		at: (self instructions indexOf: anIRInstruction)
 		put: anotherIRInstruction
 !
@@ -418,8 +418,8 @@ arguments: aCollection
 
 locals
 	^ self arguments copy
-    	addAll: (self tempDeclarations collect: [ :each | each name ]); 
-        yourself
+		addAll: (self tempDeclarations collect: [ :each | each name ]);
+		yourself
 !
 
 scope: aScope
@@ -428,8 +428,8 @@ scope: aScope
 !
 
 tempDeclarations
-	^ self instructions select: [ :each | 
-    	each isTempDeclaration ]
+	^ self instructions select: [ :each |
+		each isTempDeclaration ]
 ! !
 
 IRClosureInstruction subclass: #IRClosure
@@ -652,9 +652,9 @@ index: anInteger
 !
 
 javascriptSelector
-	^ self classSend 
-    	ifNil: [ self selector asSelector ]
-      	ifNotNil: [ self selector asSuperSelector ]
+	^ self classSend
+		ifNil: [ self selector asSelector ]
+		ifNotNil: [ self selector asSuperSelector ]
 !
 
 selector
@@ -894,13 +894,13 @@ visitIRAssignment: anIRAssignment
 !
 
 visitIRClosure: anIRClosure
-	self stream 
-		nextPutClosureWith: [ 
-        	self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |
-    				each name asVariableName ]).
-        	self stream 
-            	nextPutBlockContextFor: anIRClosure
-                during: [ super visitIRClosure: anIRClosure ] ]
+	self stream
+		nextPutClosureWith: [
+			self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |
+					each name asVariableName ]).
+			self stream
+				nextPutBlockContextFor: anIRClosure
+				during: [ super visitIRClosure: anIRClosure ] ]
 		arguments: anIRClosure arguments
 !
 
@@ -914,7 +914,7 @@ visitIRDynamicArray: anIRDynamicArray
 
 visitIRDynamicDictionary: anIRDynamicDictionary
 	self stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.
-		anIRDynamicDictionary instructions 
+		anIRDynamicDictionary instructions
 			do: [ :each | self visit: each ]
 			separatedBy: [self stream nextPutAll: ',' ].
 	self stream nextPutAll: '])'
@@ -923,16 +923,16 @@ visitIRDynamicDictionary: anIRDynamicDictionary
 visitIRMethod: anIRMethod
 
 	self stream
-		nextPutMethodDeclaration: anIRMethod 
-		with: [ self stream 
-			nextPutFunctionWith: [ 
-            	self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |
-    				each name asVariableName ]).
-            	self stream nextPutContextFor: anIRMethod during: [
+		nextPutMethodDeclaration: anIRMethod
+		with: [ self stream
+			nextPutFunctionWith: [
+				self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |
+					each name asVariableName ]).
+				self stream nextPutContextFor: anIRMethod during: [
 				anIRMethod internalVariables notEmpty ifTrue: [
 					self stream nextPutVars: (anIRMethod internalVariables asArray collect: [ :each |
 						each variable alias ]) ].
-				anIRMethod scope hasNonLocalReturn 
+				anIRMethod scope hasNonLocalReturn
 					ifTrue: [
 						self stream nextPutNonLocalReturnHandlingWith: [
 							super visitIRMethod: anIRMethod ]]
@@ -951,18 +951,18 @@ visitIRReturn: anIRReturn
 !
 
 visitIRSend: anIRSend
-	anIRSend classSend 
-    	ifNil: [
+	anIRSend classSend
+		ifNil: [
 			self stream nextPutAll: '_st('.
 			self visit: anIRSend instructions first.
-   		 	self stream nextPutAll: ').', anIRSend selector asSelector, '('.
+			self stream nextPutAll: ').', anIRSend selector asSelector, '('.
 			anIRSend instructions allButFirst
 				do: [ :each | self visit: each ]
 				separatedBy: [ self stream nextPutAll: ',' ].
 			self stream nextPutAll: ')' ]
-		ifNotNil: [ 
-			self stream 
-            	nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';
+		ifNotNil: [
+			self stream
+				nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';
 				nextPutAll: anIRSend selector asSelector, '.apply(';
 				nextPutAll: '_st('.
 			self visit: anIRSend instructions first.
@@ -980,9 +980,9 @@ visitIRSequence: anIRSequence
 !
 
 visitIRTempDeclaration: anIRTempDeclaration
-	"self stream 
-    	nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';'; 
-        lf"
+	"self stream
+		nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';
+		lf"
 !
 
 visitIRValue: anIRValue
@@ -991,8 +991,8 @@ visitIRValue: anIRValue
 
 visitIRVariable: anIRVariable
 	anIRVariable variable name = 'thisContext'
-    	ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]
-      	ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]
+		ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]
+		ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]
 !
 
 visitIRVerbatim: anIRVerbatim
@@ -1036,32 +1036,32 @@ nextPutAssignment
 !
 
 nextPutBlockContextFor: anIRClosure during: aBlock
-	self 
-    	nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; 
-        nextPutAll: String cr.
-    
-    aBlock value.
-    
-    self 
-    	nextPutAll: '}, function(', anIRClosure scope alias, ') {';
-        nextPutAll: anIRClosure scope alias, '.fillBlock({'.
-    
-    anIRClosure locals 
-    	do: [ :each |
-    		self 
-        		nextPutAll: each asVariableName;
-           	 	nextPutAll: ':';
-        		nextPutAll: each asVariableName]
+	self
+		nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {';
+		nextPutAll: String cr.
+	
+	aBlock value.
+	
+	self
+		nextPutAll: '}, function(', anIRClosure scope alias, ') {';
+		nextPutAll: anIRClosure scope alias, '.fillBlock({'.
+	
+	anIRClosure locals
+		do: [ :each |
+			self
+				nextPutAll: each asVariableName;
+				nextPutAll: ':';
+				nextPutAll: each asVariableName]
 		separatedBy: [ self nextPutAll: ',' ].
-    
-    self
-    	nextPutAll: '},';
-        nextPutAll:  anIRClosure method scope alias, ')})'
+	
+	self
+		nextPutAll: '},';
+		nextPutAll:	 anIRClosure method scope alias, ')})'
 !
 
 nextPutClosureWith: aBlock arguments: anArray
 	stream nextPutAll: '(function('.
-	anArray 
+	anArray
 		do: [ :each | stream nextPutAll: each asVariableName ]
 		separatedBy: [ stream nextPut: ',' ].
 	stream nextPutAll: '){'; lf.
@@ -1070,32 +1070,32 @@ nextPutClosureWith: aBlock arguments: anArray
 !
 
 nextPutContextFor: aMethod during: aBlock
-	self 
-    	nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; 
-        nextPutAll: String cr.
-    aBlock value.
-    
-    self 
-    	nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias; 
-        nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.
-
-    aMethod locals 
-    	do: [ :each |
-    		self 
-        		nextPutAll: each asVariableName;
-           	 	nextPutAll: ':';
-        		nextPutAll: each asVariableName]
+	self
+		nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { ';
+		nextPutAll: String cr.
+	aBlock value.
+	
+	self
+		nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;
+		nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.
+
+	aMethod locals
+		do: [ :each |
+			self
+				nextPutAll: each asVariableName;
+				nextPutAll: ':';
+				nextPutAll: each asVariableName]
 		separatedBy: [ self nextPutAll: ',' ].
-    
-    self
-    	nextPutAll: '},';
-        nextPutAll: aMethod theClass asJavascript;
-        nextPutAll: ')})'
+	
+	self
+		nextPutAll: '},';
+		nextPutAll: aMethod theClass asJavascript;
+		nextPutAll: ')})'
 !
 
 nextPutFunctionWith: aBlock arguments: anArray
 	stream nextPutAll: 'fn: function('.
-	anArray 
+	anArray
 		do: [ :each | stream nextPutAll: each asVariableName ]
 		separatedBy: [ stream nextPut: ',' ].
 	stream nextPutAll: '){'; lf.
@@ -1123,30 +1123,30 @@ nextPutIfElse: aBlock with: ifBlock with: elseBlock
 !
 
 nextPutMethodDeclaration: aMethod with: aBlock
-	stream 
+	stream
 		nextPutAll: 'smalltalk.method({'; lf;
 		nextPutAll: 'selector: "', aMethod selector, '",'; lf;
-		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf. 
+		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.
 	aBlock value.
-	stream 
+	stream
 		nextPutAll: ',', String lf, 'messageSends: ';
 		nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;
-        nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;
+		nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;
 		nextPutAll: 'referencedClasses: ['.
-	aMethod classReferences 
+	aMethod classReferences
 		do: [:each | stream nextPutAll: each asJavascript]
 		separatedBy: [stream nextPutAll: ','].
-	stream 
+	stream
 		nextPutAll: ']';
 		nextPutAll: '})'
 !
 
 nextPutNonLocalReturnHandlingWith: aBlock
-	stream 
+	stream
 		nextPutAll: 'var $early={};'; lf;
 		nextPutAll: 'try {'; lf.
 	aBlock value.
-	stream 
+	stream
 		nextPutAll: '}'; lf;
 		nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf
 !
@@ -1167,10 +1167,10 @@ nextPutReturnWith: aBlock
 !
 
 nextPutSequenceWith: aBlock
-	"stream 
+	"stream
 		nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf."
 	aBlock value.
-	"stream 
+	"stream
 		nextPutAll: '};'; lf"
 !
 
@@ -1191,9 +1191,9 @@ nextPutVar: aString
 
 nextPutVars: aCollection
 	aCollection ifEmpty: [ ^self ].
-    
+	
 	stream nextPutAll: 'var '.
-	aCollection 
+	aCollection
 		do: [ :each | stream nextPutAll: each ]
 		separatedBy: [ stream nextPutAll: ',' ].
 	stream nextPutAll: ';'; lf
@@ -1202,7 +1202,7 @@ nextPutVars: aCollection
 !BlockClosure methodsFor: '*Compiler-IR'!
 
 appendToInstruction: anIRInstruction
-    anIRInstruction appendBlock: self
+	anIRInstruction appendBlock: self
 ! !
 
 !String methodsFor: '*Compiler-IR'!

+ 29 - 29
st/Compiler-Inlining.st

@@ -158,25 +158,25 @@ Message selectors that can be inlined are answered by `IRSendInliner >> #inlined
 !IRInliner methodsFor: 'factory'!
 
 assignmentInliner
-	^ IRAssignmentInliner new 
+	^ IRAssignmentInliner new
 		translator: self;
 		yourself
 !
 
 nonLocalReturnInliner
-	^ IRNonLocalReturnInliner new 
+	^ IRNonLocalReturnInliner new
 		translator: self;
 		yourself
 !
 
 returnInliner
-	^ IRReturnInliner new 
+	^ IRReturnInliner new
 		translator: self;
 		yourself
 !
 
 sendInliner
-	^ IRSendInliner new 
+	^ IRSendInliner new
 		translator: self;
 		yourself
 ! !
@@ -184,14 +184,14 @@ sendInliner
 !IRInliner methodsFor: 'testing'!
 
 shouldInlineAssignment: anIRAssignment
-	^ anIRAssignment isInlined not and: [ 
+	^ anIRAssignment isInlined not and: [
 		anIRAssignment instructions last isSend and: [	
 			self shouldInlineSend: (anIRAssignment instructions last) ]]
 !
 
 shouldInlineReturn: anIRReturn
-	^ anIRReturn isInlined not and: [ 
-		anIRReturn instructions first isSend and: [	
+	^ anIRReturn isInlined not and: [
+		anIRReturn instructions first isSend and: [
 			self shouldInlineSend: (anIRReturn instructions first) ]]
 !
 
@@ -219,19 +219,19 @@ transformNonLocalReturn: anIRNonLocalReturn
 !
 
 visitIRAssignment: anIRAssignment
-	^ (self shouldInlineAssignment: anIRAssignment) 
+	^ (self shouldInlineAssignment: anIRAssignment)
 		ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]
 		ifFalse: [ super visitIRAssignment: anIRAssignment ]
 !
 
 visitIRNonLocalReturn: anIRNonLocalReturn
-	^ (self shouldInlineReturn: anIRNonLocalReturn) 
+	^ (self shouldInlineReturn: anIRNonLocalReturn)
 		ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]
 		ifFalse: [ self transformNonLocalReturn: anIRNonLocalReturn ]
 !
 
 visitIRReturn: anIRReturn
-	^ (self shouldInlineReturn: anIRReturn) 
+	^ (self shouldInlineReturn: anIRReturn)
 		ifTrue: [ self returnInliner inlineReturn: anIRReturn ]
 		ifFalse: [ super visitIRReturn: anIRReturn ]
 !
@@ -260,7 +260,7 @@ visitIRInlinedClosure: anIRInlinedClosure
 !
 
 visitIRInlinedIfFalse: anIRInlinedIfFalse
-	self stream nextPutIf: [ 
+	self stream nextPutIf: [
 		self stream nextPutAll: '!! smalltalk.assert('.
 		self visit: anIRInlinedIfFalse instructions first.
 		self stream nextPutAll: ')' ]
@@ -268,17 +268,17 @@ visitIRInlinedIfFalse: anIRInlinedIfFalse
 !
 
 visitIRInlinedIfNil: anIRInlinedIfNil
-	self stream nextPutIf: [ 
-		self stream nextPutAll: '($receiver = '. 
+	self stream nextPutIf: [
+		self stream nextPutAll: '($receiver = '.
 		self visit: anIRInlinedIfNil instructions first.
 		self stream nextPutAll: ') == nil || $receiver == undefined' ]
 		with: [ self visit: anIRInlinedIfNil instructions last ]
 !
 
 visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil
-	self stream 
-		nextPutIfElse: [ 
-			self stream nextPutAll: '($receiver = '. 
+	self stream
+		nextPutIfElse: [
+			self stream nextPutAll: '($receiver = '.
 			self visit: anIRInlinedIfNilIfNotNil instructions first.
 			self stream nextPutAll: ') == nil || $receiver == undefined' ]
 		with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]
@@ -286,17 +286,17 @@ visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil
 !
 
 visitIRInlinedIfTrue: anIRInlinedIfTrue
-	self stream nextPutIf: [ 
-		self stream nextPutAll: 'smalltalk.assert('. 
+	self stream nextPutIf: [
+		self stream nextPutAll: 'smalltalk.assert('.
 		self visit: anIRInlinedIfTrue instructions first.
 		self stream nextPutAll: ')' ]
 		with: [ self visit: anIRInlinedIfTrue instructions last ]
 !
 
 visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse
-	self stream 
-		nextPutIfElse: [ 
-			self stream nextPutAll: 'smalltalk.assert('. 
+	self stream
+		nextPutIfElse: [
+			self stream nextPutAll: 'smalltalk.assert('.
 			self visit: anIRInlinedIfTrueIfFalse instructions first.
 			self stream nextPutAll: ')' ]
 		with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]
@@ -314,7 +314,7 @@ visitIRInlinedReturn: anIRInlinedReturn
 !
 
 visitIRInlinedSequence: anIRInlinedSequence
-	anIRInlinedSequence instructions do: [ :each | 
+	anIRInlinedSequence instructions do: [ :each |
 		self stream nextPutStatementWith: [ self visit: each ]]
 ! !
 
@@ -369,8 +369,8 @@ ifFalse: anIRInstruction ifTrue: anotherIRInstruction
 !
 
 ifNil: anIRInstruction
-	^ self 
-		inlinedSend: IRInlinedIfNilIfNotNil new 
+	^ self
+		inlinedSend: IRInlinedIfNilIfNotNil new
 		with: anIRInstruction
 		with: (IRClosure new
 			scope: anIRInstruction scope copy;
@@ -385,7 +385,7 @@ ifNil: anIRInstruction ifNotNil: anotherIRInstruction
 !
 
 ifNotNil: anIRInstruction
-	^ self 
+	^ self
 		inlinedSend: IRInlinedIfNilIfNotNil new
 		with: (IRClosure new
 			scope: anIRInstruction scope copy;
@@ -415,7 +415,7 @@ inlineClosure: anIRClosure
 	inlinedClosure scope: anIRClosure scope.
 
 	"Add the possible temp declarations"
-	anIRClosure instructions do: [ :each | 
+	anIRClosure instructions do: [ :each |
 		each isSequence ifFalse: [
 			inlinedClosure add: each ]].
 
@@ -439,8 +439,8 @@ inlineClosure: anIRClosure
 
 inlineSend: anIRSend
 	self send: anIRSend.
-	^ self 
-		perform: self send selector 
+	^ self
+		perform: self send selector
 		withArguments: self send instructions allButFirst
 !
 
@@ -500,7 +500,7 @@ IRSendInliner subclass: #IRAssignmentInliner
 	instanceVariableNames: 'assignment'
 	package: 'Compiler-Inlining'!
 !IRAssignmentInliner commentStamp!
-I inline message sends together with assignments by moving them around into the inline closure instructions. 
+I inline message sends together with assignments by moving them around into the inline closure instructions.
 
 ##Example
 

+ 146 - 146
st/Compiler-Interpreter.st

@@ -56,27 +56,27 @@ receiver: anObject
 
 selector
 	^ self metod
-    	ifNotNil: [ self method selector ]
+		ifNotNil: [ self method selector ]
 ! !
 
 !AIContext methodsFor: 'initialization'!
 
 initializeFromMethodContext: aMethodContext
 	self pc: aMethodContext pc.
-    self receiver: aMethodContext receiver.
-    self method: aMethodContext method.
-    aMethodContext outerContext ifNotNil: [
+	self receiver: aMethodContext receiver.
+	self method: aMethodContext method.
+	aMethodContext outerContext ifNotNil: [
 		self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].
-    aMethodContext locals keysAndValuesDo: [ :key :value |
-    	self locals at: key put: value ]
+	aMethodContext locals keysAndValuesDo: [ :key :value |
+		self locals at: key put: value ]
 ! !
 
 !AIContext class methodsFor: 'instance creation'!
 
 fromMethodContext: aMethodContext
 	^ self new
-    	initializeFromMethodContext: aMethodContext;
-        yourself
+		initializeFromMethodContext: aMethodContext;
+		yourself
 ! !
 
 Object subclass: #ASTDebugger
@@ -123,16 +123,16 @@ defaultInterpreterClass
 
 buildAST
 	"Build the AST tree from the method source code.
-    The AST is annotated with a SemanticAnalyzer, 
-    to know the semantics and bindings of each node needed for later debugging"
-    
-    | ast |
-    
-    ast := Smalltalk current parse: self method source.
-    (SemanticAnalyzer on: self context receiver class)
-    	visit: ast.    
-    
-    ^ ast
+	The AST is annotated with a SemanticAnalyzer,
+	to know the semantics and bindings of each node needed for later debugging"
+	
+	| ast |
+	
+	ast := Smalltalk current parse: self method source.
+	(SemanticAnalyzer on: self context receiver class)
+		visit: ast.
+	
+	^ ast
 !
 
 initializeInterpreter
@@ -141,9 +141,9 @@ initializeInterpreter
 
 initializeWithContext: aMethodContext
 	"TODO: do we need to handle block contexts?"
-    
-    self context: (AIContext fromMethodContext: aMethodContext).
-    self initializeInterpreter
+	
+	self context: (AIContext fromMethodContext: aMethodContext).
+	self initializeInterpreter
 ! !
 
 !ASTDebugger methodsFor: 'stepping'!
@@ -157,16 +157,16 @@ resume
 !
 
 step
-	"The ASTSteppingInterpreter stops at each node interpretation. 
-    One step will interpret nodes until:
-    - we get at the end
-    - the next node is a stepping node (send, assignment, etc.)"
-    
+	"The ASTSteppingInterpreter stops at each node interpretation.
+	One step will interpret nodes until:
+	- we get at the end
+	- the next node is a stepping node (send, assignment, etc.)"
+	
 	[ (self interpreter nextNode notNil and: [ self interpreter nextNode stopOnStepping ])
-		or: [ self interpreter atEnd not ] ] 
- 			whileFalse: [
-				self interpreter step. 
-                self step ]
+		or: [ self interpreter atEnd not ] ]
+			whileFalse: [
+				self interpreter step.
+				self step ]
 !
 
 stepInto
@@ -181,8 +181,8 @@ stepOver
 
 context: aMethodContext
 	^ self new
-    	initializeWithContext: aMethodContext;
-        yourself
+		initializeWithContext: aMethodContext;
+		yourself
 ! !
 
 Object subclass: #ASTInterpreter
@@ -194,13 +194,13 @@ It is built using Continuation Passing Style for stepping purposes.
 
 Usage example:
 
-    | ast interpreter |
-    ast := Smalltalk current parse: 'foo 1+2+4'.
-    (SemanticAnalyzer on: Object) visit: ast.
+	| ast interpreter |
+	ast := Smalltalk current parse: 'foo 1+2+4'.
+	(SemanticAnalyzer on: Object) visit: ast.
 
-    ASTInterpreter new
-        interpret: ast nodes first;
-        result "Answers 7"!
+	ASTInterpreter new
+		interpret: ast nodes first;
+		result "Answers 7"!
 
 !ASTInterpreter methodsFor: 'accessing'!
 
@@ -224,41 +224,41 @@ result
 
 initialize
 	super initialize.
-    shouldReturn := false
+	shouldReturn := false
 ! !
 
 !ASTInterpreter methodsFor: 'interpreting'!
 
 interpret: aNode
 	shouldReturn := false.
-    self interpret: aNode continue: [ :value |
-    	result := value ]
+	self interpret: aNode continue: [ :value |
+		result := value ]
 !
 
 interpret: aNode continue: aBlock
 	shouldReturn ifTrue: [ ^ self ].
 
-	aNode isNode 
-    	ifTrue: [ 	
-        	currentNode := aNode.
-            self interpretNode: aNode continue: [ :value |
-  				self continue: aBlock value: value ] ]
-        ifFalse: [ self continue: aBlock value: aNode ]
+	aNode isNode
+		ifTrue: [	
+			currentNode := aNode.
+			self interpretNode: aNode continue: [ :value |
+				self continue: aBlock value: value ] ]
+		ifFalse: [ self continue: aBlock value: aNode ]
 !
 
 interpretAssignmentNode: aNode continue: aBlock
 	self interpret: aNode right continue: [ :value |
-    	self 
-        	continue: aBlock
-            value: (self assign: aNode left to: value) ]
+		self
+			continue: aBlock
+			value: (self assign: aNode left to: value) ]
 !
 
 interpretBlockNode: aNode continue: aBlock
 	"TODO: Context should be set"
-    
-    self 
-    	continue: aBlock 
-        value: [ self interpret: aNode nodes first; result ]
+	
+	self
+		continue: aBlock
+		value: [ self interpret: aNode nodes first; result ]
 !
 
 interpretBlockSequenceNode: aNode continue: aBlock
@@ -268,16 +268,16 @@ interpretBlockSequenceNode: aNode continue: aBlock
 interpretCascadeNode: aNode continue: aBlock
 	"TODO: Handle super sends"
 	
-    self interpret: aNode receiver continue: [ :receiver |
+	self interpret: aNode receiver continue: [ :receiver |
 		"Only interpret the receiver once"
-        aNode nodes do: [ :each | each receiver: receiver ].
-  
-    	self 
-        	interpretAll: aNode nodes allButLast
-    		continue: [
-              	self 
-                	interpret: aNode nodes last
-                	continue: [ :val | self continue: aBlock value: val ] ] ]
+		aNode nodes do: [ :each | each receiver: receiver ].
+
+		self
+			interpretAll: aNode nodes allButLast
+			continue: [
+				self
+					interpret: aNode nodes last
+					continue: [ :val | self continue: aBlock value: val ] ] ]
 !
 
 interpretClassReferenceNode: aNode continue: aBlock
@@ -286,18 +286,18 @@ interpretClassReferenceNode: aNode continue: aBlock
 
 interpretDynamicArrayNode: aNode continue: aBlock
 	self interpretAll: aNode nodes continue: [ :array |
-    	self 
-        	continue: aBlock
+		self
+			continue: aBlock
 			value: array ]
 !
 
 interpretDynamicDictionaryNode: aNode continue: aBlock
-    self interpretAll: aNode nodes continue: [ :array | | hashedCollection |
-    	hashedCollection := HashedCollection new.
-        array do: [ :each | hashedCollection add: each ].
-        self 	
-        	continue: aBlock
-            value: hashedCollection ]
+	self interpretAll: aNode nodes continue: [ :array | | hashedCollection |
+		hashedCollection := HashedCollection new.
+		array do: [ :each | hashedCollection add: each ].
+		self	
+			continue: aBlock
+			value: hashedCollection ]
 !
 
 interpretJSStatementNode: aNode continue: aBlock
@@ -307,37 +307,37 @@ interpretJSStatementNode: aNode continue: aBlock
 
 interpretMethodNode: aNode continue: aBlock
 	self interpretAll: aNode nodes continue: [ :array |
-    	self continue: aBlock value: array first ]
+		self continue: aBlock value: array first ]
 !
 
 interpretNode: aNode continue: aBlock
-    aNode interpreter: self continue: aBlock
+	aNode interpreter: self continue: aBlock
 !
 
 interpretReturnNode: aNode continue: aBlock
-    self interpret: aNode nodes first continue: [ :value |
-    	shouldReturn := true.
+	self interpret: aNode nodes first continue: [ :value |
+		shouldReturn := true.
 		self continue: aBlock value: value ]
 !
 
 interpretSendNode: aNode continue: aBlock
 	"TODO: Handle super sends"
-    
-    self interpret: aNode receiver continue: [ :receiver |
-    	self interpretAll: aNode arguments continue: [ :args |
-    		self 
-            	messageFromSendNode: aNode 
-                arguments: args
-                do: [ :message |
-        			self context pc: self context pc + 1.
-        			self 
-            			continue: aBlock 
-                		value: (message sendTo: receiver) ] ] ]
+	
+	self interpret: aNode receiver continue: [ :receiver |
+		self interpretAll: aNode arguments continue: [ :args |
+			self
+				messageFromSendNode: aNode
+				arguments: args
+				do: [ :message |
+					self context pc: self context pc + 1.
+					self
+						continue: aBlock
+						value: (message sendTo: receiver) ] ] ]
 !
 
 interpretSequenceNode: aNode continue: aBlock
 	self interpretAll: aNode nodes continue: [ :array |
-    	self continue: aBlock value: array last ]
+		self continue: aBlock value: array last ]
 !
 
 interpretValueNode: aNode continue: aBlock
@@ -345,9 +345,9 @@ interpretValueNode: aNode continue: aBlock
 !
 
 interpretVariableNode: aNode continue: aBlock
-    self 
-    	continue: aBlock
-        value: (aNode binding isInstanceVar
+	self
+		continue: aBlock
+		value: (aNode binding isInstanceVar
 			ifTrue: [ self context receiver instVarAt: aNode value ]
 			ifFalse: [ self context localAt: aNode value ])
 ! !
@@ -355,62 +355,62 @@ interpretVariableNode: aNode continue: aBlock
 !ASTInterpreter methodsFor: 'private'!
 
 assign: aNode to: anObject
-	^ aNode binding isInstanceVar 
-    	ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]
-      	ifFalse: [ self context localAt: aNode value put: anObject ]
+	^ aNode binding isInstanceVar
+		ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]
+		ifFalse: [ self context localAt: aNode value put: anObject ]
 !
 
 continue: aBlock value: anObject
 	result := anObject.
-    aBlock value: anObject
+	aBlock value: anObject
 !
 
 eval: aString
-	"Evaluate aString as JS source inside an JS function. 
-    aString is not sandboxed."
-    
-    | source function |
-    
-    source := String streamContents: [ :str |
-    	str nextPutAll: '(function('.
-        self context locals keys 
-        	do: [ :each | str nextPutAll: each ]
-          	separatedBy: [ str nextPutAll: ',' ].
-        str 
-        	nextPutAll: '){ return (function() {';
-        	nextPutAll: aString;
-            nextPutAll: '})() })' ].
-            
+	"Evaluate aString as JS source inside an JS function.
+	aString is not sandboxed."
+	
+	| source function |
+	
+	source := String streamContents: [ :str |
+		str nextPutAll: '(function('.
+		self context locals keys
+			do: [ :each | str nextPutAll: each ]
+			separatedBy: [ str nextPutAll: ',' ].
+		str
+			nextPutAll: '){ return (function() {';
+			nextPutAll: aString;
+			nextPutAll: '})() })' ].
+			
 	function := Compiler new eval: source.
-    
+	
 	^ function valueWithPossibleArguments: self context locals values
 !
 
 interpretAll: aCollection continue: aBlock
-	self 
-    	interpretAll: aCollection 
-        continue: aBlock 
-        result: OrderedCollection new
+	self
+		interpretAll: aCollection
+		continue: aBlock
+		result: OrderedCollection new
 !
 
 interpretAll: nodes continue: aBlock result: aCollection
-	nodes isEmpty 
-    	ifTrue: [ self continue: aBlock value: aCollection ]
-    	ifFalse: [
-    		self interpret: nodes first continue: [:value |
-    			self 
-                	interpretAll: nodes allButFirst 
-                    continue: aBlock
-  					result: aCollection, { value } ] ]
+	nodes isEmpty
+		ifTrue: [ self continue: aBlock value: aCollection ]
+		ifFalse: [
+			self interpret: nodes first continue: [:value |
+				self
+					interpretAll: nodes allButFirst
+					continue: aBlock
+					result: aCollection, { value } ] ]
 !
 
 messageFromSendNode: aSendNode arguments: aCollection do: aBlock
-    self 
-        continue: aBlock
-        value: (Message new
-    		selector: aSendNode selector;
-        	arguments: aCollection;
-        	yourself)
+	self
+		continue: aBlock
+		value: (Message new
+			selector: aSendNode selector;
+			arguments: aCollection;
+			yourself)
 ! !
 
 !ASTInterpreter methodsFor: 'testing'!
@@ -428,21 +428,21 @@ Use `#step` to actually interpret the next node.
 
 Usage example:
 
-    | ast interpreter |
-    ast := Smalltalk current parse: 'foo 1+2+4'.
-    (SemanticAnalyzer on: Object) visit: ast.
-
-    interpreter := ASTSteppingInterpreter new
-        interpret: ast nodes first;
-        yourself.
-        
-    debugger step; step.
-    debugger step; step.
-    debugger result."Answers 1"
-    debugger step.
-    debugger result. "Answers 3"
-    debugger step.
-    debugger result. "Answers 7"!
+	| ast interpreter |
+	ast := Smalltalk current parse: 'foo 1+2+4'.
+	(SemanticAnalyzer on: Object) visit: ast.
+
+	interpreter := ASTSteppingInterpreter new
+		interpret: ast nodes first;
+		yourself.
+		
+	debugger step; step.
+	debugger step; step.
+	debugger result."Answers 1"
+	debugger step.
+	debugger result. "Answers 3"
+	debugger step.
+	debugger result. "Answers 7"!
 
 !ASTSteppingInterpreter methodsFor: 'accessing'!
 
@@ -454,15 +454,15 @@ nextNode
 
 initialize
 	super initialize.
-    continuation := [  ]
+	continuation := []
 ! !
 
 !ASTSteppingInterpreter methodsFor: 'interpreting'!
 
 interpret: aNode continue: aBlock
 	nextNode := aNode.
-	continuation := [ 
-    	super interpret: aNode continue: aBlock ]
+	continuation := [
+		super interpret: aNode continue: aBlock ]
 ! !
 
 !ASTSteppingInterpreter methodsFor: 'stepping'!

+ 27 - 27
st/Compiler-Semantic.st

@@ -24,7 +24,7 @@ args
 !
 
 bindingFor: aStringOrNode
-	^ self pseudoVars at: aStringOrNode value ifAbsent: [ 
+	^ self pseudoVars at: aStringOrNode value ifAbsent: [
 		self args at: aStringOrNode value ifAbsent: [
 			self temps at: aStringOrNode value ifAbsent: [ nil ]]]
 !
@@ -41,7 +41,7 @@ lookupVariable: aNode
 	| lookup |
 	lookup := (self bindingFor: aNode).
 	lookup ifNil: [
-		lookup := self outerScope ifNotNil: [ 
+		lookup := self outerScope ifNotNil: [
 			(self outerScope lookupVariable: aNode) ]].
 	^ lookup
 !
@@ -76,7 +76,7 @@ pseudoVars
 scopeLevel
 	self outerScope ifNil: [ ^ 1 ].
 	self isInlined ifTrue: [ ^ self outerScope scopeLevel ].
-    
+	
 	^ self outerScope scopeLevel + 1
 !
 
@@ -108,7 +108,7 @@ isBlockScope
 
 isInlined
 	^ self instruction notNil and: [
-      	self instruction isInlined ]
+		self instruction isInlined ]
 !
 
 isMethodScope
@@ -203,7 +203,7 @@ Object subclass: #ScopeVar
 	instanceVariableNames: 'scope name'
 	package: 'Compiler-Semantic'!
 !ScopeVar commentStamp!
-I am an entry in a LexicalScope that gets associated with variable nodes of the same name.  
+I am an entry in a LexicalScope that gets associated with variable nodes of the same name.	
 There are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.!
 
 !ScopeVar methodsFor: 'accessing'!
@@ -264,7 +264,7 @@ validateAssignment
 !ScopeVar class methodsFor: 'instance creation'!
 
 on: aString
-	^ self new 
+	^ self new
 		name: aString;
 		yourself
 ! !
@@ -413,18 +413,18 @@ errorShadowingVariable: aString
 
 errorUnknownVariable: aNode
 	"Throw an error if the variable is undeclared in the global JS scope (i.e. window).
-    We allow four variable names in addition: `jQuery`, `window`, `process` and `global` 
-    for nodejs and browser environments. 
-    
-    This is only to make sure compilation works on both browser-based and nodejs environments.
-    The ideal solution would be to use a pragma instead"
+	We allow four variable names in addition: `jQuery`, `window`, `process` and `global`
+	for nodejs and browser environments.
+	
+	This is only to make sure compilation works on both browser-based and nodejs environments.
+	The ideal solution would be to use a pragma instead"
 
 	| identifier |
-    identifier := aNode value.
-    
-	((#('jQuery' 'window' 'document' 'process' 'global') includes: identifier) not 
-        and: [ self isVariableGloballyUndefined: identifier ]) 
-        	ifTrue: [
+	identifier := aNode value.
+	
+	((#('jQuery' 'window' 'document' 'process' 'global') includes: identifier) not
+		and: [ self isVariableGloballyUndefined: identifier ])
+			ifTrue: [
 				UnknownVariableError new
 					variableName: aNode value;
 					signal ]
@@ -443,7 +443,7 @@ newMethodScope
 !
 
 newScopeOfClass: aLexicalScopeClass
-	^ aLexicalScopeClass new 
+	^ aLexicalScopeClass new
 		outerScope: currentScope;
 		yourself
 ! !
@@ -485,7 +485,7 @@ visitBlockNode: aNode
 	aNode scope: currentScope.
 	currentScope node: aNode.
 	
-	aNode parameters do: [ :each | 
+	aNode parameters do: [ :each |
 		self validateVariableScope: each.
 		currentScope addArg: each ].
 
@@ -495,7 +495,7 @@ visitBlockNode: aNode
 
 visitCascadeNode: aNode
 	"Populate the receiver into all children"
-	aNode nodes do: [ :each | 
+	aNode nodes do: [ :each |
 		each receiver: aNode receiver ].
 	super visitCascadeNode: aNode.
 	aNode nodes first superSend ifTrue: [
@@ -512,18 +512,18 @@ visitMethodNode: aNode
 	aNode scope: currentScope.
 	currentScope node: aNode.
 
-	self theClass allInstanceVariableNames do: [:each | 
+	self theClass allInstanceVariableNames do: [:each |
 		currentScope addIVar: each ].
-	aNode arguments do: [ :each | 
+	aNode arguments do: [ :each |
 		self validateVariableScope: each.
 		currentScope addArg: each ].
 
 	super visitMethodNode: aNode.
 
-	aNode 
+	aNode
 		classReferences: self classReferences;
 		messageSends: self messageSends keys;
-        superSends: self superSends keys.
+		superSends: self superSends keys.
 	self popScope
 !
 
@@ -537,13 +537,13 @@ visitReturnNode: aNode
 
 visitSendNode: aNode
 
-	aNode receiver value = 'super' 
+	aNode receiver value = 'super'
 		ifTrue: [
 			aNode superSend: true.
 			aNode receiver value: 'self'.
 			self superSends at: aNode selector ifAbsentPut: [ Set new ].
 			(self superSends at: aNode selector) add: aNode ]
-          
+		
 		ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [
 			aNode shouldBeInlined: true.
 			aNode receiver shouldBeAliased: true ] ].
@@ -557,7 +557,7 @@ visitSendNode: aNode
 !
 
 visitSequenceNode: aNode
-	aNode temps do: [ :each | 
+	aNode temps do: [ :each |
 		self validateVariableScope: each.
 		currentScope addTemp: each ].
 
@@ -568,7 +568,7 @@ visitVariableNode: aNode
 	"Bind a ScopeVar to aNode by doing a lookup in the current scope.
 	If no ScopeVar is found, bind a UnknowVar and throw an error"
 
-	aNode binding: ((currentScope lookupVariable: aNode) ifNil: [ 
+	aNode binding: ((currentScope lookupVariable: aNode) ifNil: [
 		self errorUnknownVariable: aNode.
 		UnknownVar new name: aNode value; yourself ])
 ! !

+ 110 - 110
st/Compiler-Tests.st

@@ -13,37 +13,37 @@ interpreter
 
 analyze: aNode forClass: aClass
 	(SemanticAnalyzer on: aClass) visit: aNode.
-    ^ aNode
+	^ aNode
 !
 
 interpret: aString
-	^ self 
-    	interpret: aString 
-        withArguments: Dictionary new
+	^ self
+		interpret: aString
+		withArguments: Dictionary new
 !
 
 interpret: aString receiver: anObject withArguments: aDictionary
 	"The food is a methodNode. Interpret the sequenceNode only"
-    
-    | ctx |
-    
-    ctx := AIContext new.
-    ctx receiver: anObject.
-    aDictionary keysAndValuesDo: [ :key :value |
-    	ctx localAt: key put: value ].
-    
-    ^ self interpreter
-    	context: ctx;
-    	interpret: (self parse: aString forClass: anObject class) 
-        	nodes first;
-        result
+	
+	| ctx |
+	
+	ctx := AIContext new.
+	ctx receiver: anObject.
+	aDictionary keysAndValuesDo: [ :key :value |
+		ctx localAt: key put: value ].
+	
+	^ self interpreter
+		context: ctx;
+		interpret: (self parse: aString forClass: anObject class)
+			nodes first;
+		result
 !
 
 interpret: aString withArguments: aDictionary
-	^ self 
-    	interpret: aString 
-        receiver: Object new
-        withArguments: aDictionary
+	^ self
+		interpret: aString
+		receiver: Object new
+		withArguments: aDictionary
 ! !
 
 !AbstractASTInterpreterTest methodsFor: 'parsing'!
@@ -74,8 +74,8 @@ testBinarySend
 
 testBlockLiteral
 	self assert: (self interpret: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 1.
-    self assert: (self interpret: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]') equals: 1.
-    self assert: (self interpret: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 2
+	self assert: (self interpret: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]') equals: 1.
+	self assert: (self interpret: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 2
 !
 
 testCascade
@@ -92,30 +92,30 @@ testDynamicDictionary
 
 testInlinedJSStatement
 	self assert: (self interpret: 'foo <return 2+3>') equals: 5.
-    
-    self 
-    	assert: (self 
-    		interpret: 'foo: anInteger <return 2 + anInteger>' 
-        	withArguments: #{ 'anInteger' -> 3}) 
+	
+	self
+		assert: (self
+			interpret: 'foo: anInteger <return 2 + anInteger>'
+			withArguments: #{ 'anInteger' -> 3})
 		equals: 5
 !
 
 testInstVarAccess
-	self 
-    	assert: (self 
-    		interpret: 'foo ^ x'
-        	receiver: 2@3
-        	withArguments: #{})
-        equals: 2
+	self
+		assert: (self
+			interpret: 'foo ^ x'
+			receiver: 2@3
+			withArguments: #{})
+		equals: 2
 !
 
 testInstVarAssignment
-	self 
-    	assert: (self 
-    		interpret: 'foo: anInteger x := anInteger. ^ x'
-        	receiver: Point new
-        	withArguments: #{'anInteger' -> 2})
-        equals: 2
+	self
+		assert: (self
+			interpret: 'foo: anInteger x := anInteger. ^ x'
+			receiver: Point new
+			withArguments: #{'anInteger' -> 2})
+		equals: 2
 !
 
 testNonlocalReturn
@@ -123,12 +123,12 @@ testNonlocalReturn
 !
 
 testReceiver
-	self 
-    	assert: (self 
-    		interpret: 'foo ^ self'
-        	receiver: 2@3
-        	withArguments: #{})
-        equals: 2@3
+	self
+		assert: (self
+			interpret: 'foo ^ self'
+			receiver: 2@3
+			withArguments: #{})
+		equals: 2@3
 !
 
 testTempAssignment
@@ -149,55 +149,55 @@ interpreter
 
 testAtEnd
 	self interpret: 'foo 1 + 2'.
-    self deny: self interpreter atEnd.
+	self deny: self interpreter atEnd.
 
-    self interpreter step.
-    self deny: self interpreter atEnd.
-    
-    self interpreter step.
-    self deny: self interpreter atEnd.
-    
-    self interpreter step.
-    self deny: self interpreter atEnd.
-    
-    self interpreter step.
-    self assert: self interpreter atEnd
+	self interpreter step.
+	self deny: self interpreter atEnd.
+	
+	self interpreter step.
+	self deny: self interpreter atEnd.
+	
+	self interpreter step.
+	self deny: self interpreter atEnd.
+	
+	self interpreter step.
+	self assert: self interpreter atEnd
 !
 
 testMessageSend
 	self interpret: 'foo 1 + 2'.
-    
-    "SequenceNode"
-    self interpreter step.
-    
-    "SendNode"
-    self interpreter step.
-    
-     "ValueNode"
-    self interpreter step.
-    self assert: self interpreter currentNode value equals: 1.
-    
-    "ValueNode"
-    self interpreter step.
-    self assert: self interpreter currentNode value equals: 2.
-    
-    "Result"
-    self interpreter step.
-    self assert: self interpreter result equals: 3
+	
+	"SequenceNode"
+	self interpreter step.
+	
+	"SendNode"
+	self interpreter step.
+	
+	 "ValueNode"
+	self interpreter step.
+	self assert: self interpreter currentNode value equals: 1.
+	
+	"ValueNode"
+	self interpreter step.
+	self assert: self interpreter currentNode value equals: 2.
+	
+	"Result"
+	self interpreter step.
+	self assert: self interpreter result equals: 3
 !
 
 testSimpleStepping
 	self interpret: 'foo 1'.
-    
-    "SequenceNode"
-    self interpreter step.
-    
-    self assert: self interpreter result isNil.
-    
-    "ValueNode"
-    self interpreter step.
-    
-    self assert: self interpreter result equals: 1
+	
+	"SequenceNode"
+	self interpreter step.
+	
+	self assert: self interpreter result isNil.
+	
+	"ValueNode"
+	self interpreter step.
+	
+	self assert: self interpreter result equals: 1
 ! !
 
 TestCase subclass: #CodeGeneratorTest
@@ -265,40 +265,40 @@ testCascades
 
 testDynamicArrayElementsOrdered
 	self should: 'foo
-  | x |
-  x := 1.
-  ^ { x. true ifTrue: [ x := 2 ] }
+	| x |
+	x := 1.
+	^ { x. true ifTrue: [ x := 2 ] }
 ' return: #(1 2).
 !
 
 testDynamicDictionaryElementsOrdered
 	self should: 'foo
-  | x |
-  x := ''foo''->1.
-  ^ #{ x. (true ifTrue: [ x := ''bar''->2 ]) }
+	| x |
+	x := ''foo''->1.
+	^ #{ x. (true ifTrue: [ x := ''bar''->2 ]) }
 ' return: #{'foo'->1. 'bar'->2}.
 !
 
 testInnerTemporalDependentElementsOrdered
 	self should: 'foo
-  | x |
-  x := Array.
-  ^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
+	| x |
+	x := Array.
+	^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
 ' return: {'foo'->Array. 'bar'->2}.
 	self should: 'foo
-  | x |
-  x := 1.
-  ^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
+	| x |
+	x := 1.
+	^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
 ' return: {'foo'->1. 'bar'->2}.
 	self should: 'foo
-  | x |
-  x := 1.
-  ^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
+	| x |
+	x := 1.
+	^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
 ' return: {'foo'->1. 'bar'->2}.
 	self should: 'foo
-  | x |
-  x := 1.
-  ^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
+	| x |
+	x := 1.
+	^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
 ' return: #{'foo'->1. 'bar'->2}.
 !
 
@@ -349,15 +349,15 @@ testNonLocalReturn
 
 testSendReceiverAndArgumentsOrdered
 	self should: 'foo
-  | x |
-  x := 1.
-  ^ Array with: x with: (true ifTrue: [ x := 2 ])
+	| x |
+	x := 1.
+	^ Array with: x with: (true ifTrue: [ x := 2 ])
 ' return: #(1 2).
 
 	self should: 'foo
-  | x |
-  x := Array.
-  ^ x with: x with: (true ifTrue: [ x := 2 ])
+	| x |
+	x := Array.
+	^ x with: x with: (true ifTrue: [ x := 2 ])
 ' return: {Array. 2}.
 !
 

+ 12 - 12
st/Examples.st

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

File diff suppressed because it is too large
+ 251 - 251
st/IDE.st


+ 112 - 112
st/Importer-Exporter.st

@@ -24,13 +24,13 @@ nextChunk
 
 	| char result chunk |
 	result := '' writeStream.
-        [char := stream next.
-        char notNil] whileTrue: [
-                 char = '!!' ifTrue: [
-                         stream peek = '!!'
-                                ifTrue: [stream next "skipping the escape double"]
-                                ifFalse: [^result contents trimBoth  "chunk end marker found"]].
-                 result nextPut: char].
+		[char := stream next.
+		char notNil] whileTrue: [
+				 char = '!!' ifTrue: [
+						 stream peek = '!!'
+								ifTrue: [stream next "skipping the escape double"]
+								ifFalse: [^result contents trimBoth	 "chunk end marker found"]].
+				 result nextPut: char].
 	^nil "a chunk needs to end with !!"
 ! !
 
@@ -47,10 +47,10 @@ Object subclass: #Exporter
 !Exporter methodsFor: 'fileOut'!
 
 exportAll
-    "Export all packages in the system."
+	"Export all packages in the system."
 
-    ^String streamContents: [:stream |
-    	Smalltalk current packages do: [:pkg |
+	^String streamContents: [:stream |
+		Smalltalk current packages do: [:pkg |
 		stream nextPutAll: (self exportPackage: pkg name)]]
 !
 
@@ -69,13 +69,13 @@ exportPackage: packageName
 
 	| package |
 	^String streamContents: [:stream |
-                package := Smalltalk current packageAt: packageName.
-                self exportPackageDefinitionOf: package on: stream.
+				package := Smalltalk current packageAt: packageName.
+				self exportPackageDefinitionOf: package on: stream.
 
 		"Export classes in dependency order.
 		Update (issue #171): Remove duplicates for export"
-	    	package sortedClasses asSet do: [:each |
-                        stream nextPutAll: (self exportClass: each)].
+			package sortedClasses asSet do: [:each |
+						stream nextPutAll: (self exportClass: each)].
 		self exportPackageExtensionsOf: package on: stream]
 ! !
 
@@ -83,29 +83,29 @@ exportPackage: packageName
 
 classNameFor: aClass
 	^aClass isMetaclass
-	    ifTrue: [aClass instanceClass name, '.klass']
-	    ifFalse: [
+		ifTrue: [aClass instanceClass name, '.klass']
+		ifFalse: [
 		aClass isNil
-		    ifTrue: ['nil']
-		    ifFalse: [aClass name]]
+			ifTrue: ['nil']
+			ifFalse: [aClass name]]
 !
 
 exportDefinitionOf: aClass on: aStream
-	aStream 
-	    nextPutAll: 'smalltalk.addClass(';
-	    nextPutAll: '''', (self classNameFor: aClass), ''', ';
-	    nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
-	    nextPutAll: ', ['.
-	aClass instanceVariableNames 
-	    do: [:each | aStream nextPutAll: '''', each, '''']
-	    separatedBy: [aStream nextPutAll: ', '].
-	aStream	
-	    nextPutAll: '], ''';
-	    nextPutAll: aClass category, '''';
-	    nextPutAll: ');'.
+	aStream
+		nextPutAll: 'smalltalk.addClass(';
+		nextPutAll: '''', (self classNameFor: aClass), ''', ';
+		nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
+		nextPutAll: ', ['.
+	aClass instanceVariableNames
+		do: [:each | aStream nextPutAll: '''', each, '''']
+		separatedBy: [aStream nextPutAll: ', '].
+	aStream
+		nextPutAll: '], ''';
+		nextPutAll: aClass category, '''';
+		nextPutAll: ');'.
 	aClass comment notEmpty ifTrue: [
-	    aStream 
-	    	lf;
+		aStream
+			lf;
 		nextPutAll: 'smalltalk.';
 		nextPutAll: (self classNameFor: aClass);
 		nextPutAll: '.comment=';
@@ -115,17 +115,17 @@ exportDefinitionOf: aClass on: aStream
 
 exportMetaDefinitionOf: aClass on: aStream
 	aClass class instanceVariableNames isEmpty ifFalse: [
-	    aStream 
+		aStream
 		nextPutAll: 'smalltalk.', (self classNameFor: aClass class);
 		nextPutAll: '.iVarNames = ['.
-	    aClass class instanceVariableNames
+		aClass class instanceVariableNames
 		do: [:each | aStream nextPutAll: '''', each, '''']
 		separatedBy: [aStream nextPutAll: ','].
-	    aStream nextPutAll: '];', String lf]
+		aStream nextPutAll: '];', String lf]
 !
 
 exportMethod: aMethod of: aClass on: aStream
-	aStream 
+	aStream
 		nextPutAll: 'smalltalk.addMethod(';lf;
 		nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
 		nextPutAll: 'smalltalk.method({';lf;
@@ -153,10 +153,10 @@ exportMethodsOf: aClass on: aStream
 !
 
 exportPackageDefinitionOf: package on: aStream
-	aStream 
-	    nextPutAll: 'smalltalk.addPackage(';
-	    nextPutAll: '''', package name, ''');';
-        lf
+	aStream
+		nextPutAll: 'smalltalk.addPackage(';
+		nextPutAll: '''', package name, ''');';
+		lf
 !
 
 exportPackageExtensionsOf: package on: aStream
@@ -165,7 +165,7 @@ exportPackageExtensionsOf: package on: aStream
 	| name |
 	name := package name.
 	(Package sortedClasses: Smalltalk current classes) do: [:each |
-		{each. each class} do: [:aClass | 
+		{each. each class} do: [:aClass |
 			((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |
 				(method category match: '^\*', name) ifTrue: [
 					self exportMethod: method of: aClass on: aStream ]]]]
@@ -185,48 +185,48 @@ chunkEscape: aString
 
 classNameFor: aClass
 	^aClass isMetaclass
-	    ifTrue: [aClass instanceClass name, ' class']
-	    ifFalse: [
+		ifTrue: [aClass instanceClass name, ' class']
+		ifFalse: [
 		aClass isNil
-		    ifTrue: ['nil']
-		    ifFalse: [aClass name]]
+			ifTrue: ['nil']
+			ifFalse: [aClass name]]
 !
 
 exportDefinitionOf: aClass on: aStream
-    "Chunk format."
-
-    aStream 
-        nextPutAll: (self classNameFor: aClass superclass);
-        nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;
-        nextPutAll: '	instanceVariableNames: '''.
-    aClass instanceVariableNames 
-        do: [:each | aStream nextPutAll: each]
-        separatedBy: [aStream nextPutAll: ' '].
-    aStream 
-        nextPutAll: ''''; lf;
-        nextPutAll: '	package: ''', aClass category, '''!!'; lf.
-    aClass comment notEmpty ifTrue: [
-        aStream 
-        nextPutAll: '!!', (self classNameFor: aClass), ' commentStamp!!';lf;
-        nextPutAll: (self chunkEscape: aClass comment), '!!';lf].
-    aStream lf
+	"Chunk format."
+
+	aStream
+		nextPutAll: (self classNameFor: aClass superclass);
+		nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;
+		nextPutAll: '	instanceVariableNames: '''.
+	aClass instanceVariableNames
+		do: [:each | aStream nextPutAll: each]
+		separatedBy: [aStream nextPutAll: ' '].
+	aStream
+		nextPutAll: ''''; lf;
+		nextPutAll: '	package: ''', aClass category, '''!!'; lf.
+	aClass comment notEmpty ifTrue: [
+		aStream
+		nextPutAll: '!!', (self classNameFor: aClass), ' commentStamp!!';lf;
+		nextPutAll: (self chunkEscape: aClass comment), '!!';lf].
+	aStream lf
 !
 
 exportMetaDefinitionOf: aClass on: aStream
 
 	aClass class instanceVariableNames isEmpty ifFalse: [
-		aStream 
-		    nextPutAll: (self classNameFor: aClass class);
-		    nextPutAll: ' instanceVariableNames: '''.
-		aClass class instanceVariableNames 
-		    do: [:each | aStream nextPutAll: each]
-		    separatedBy: [aStream nextPutAll: ' '].
-		aStream	
-		    nextPutAll: '''!!'; lf; lf]
+		aStream
+			nextPutAll: (self classNameFor: aClass class);
+			nextPutAll: ' instanceVariableNames: '''.
+		aClass class instanceVariableNames
+			do: [:each | aStream nextPutAll: each]
+			separatedBy: [aStream nextPutAll: ' '].
+		aStream
+			nextPutAll: '''!!'; lf; lf]
 !
 
 exportMethod: aMethod of: aClass on: aStream
-	aStream 
+	aStream
 		lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;
 		nextPutAll: '!!'
 !
@@ -247,7 +247,7 @@ exportMethodsOf: aClass on: aStream
 
 	| map |
 	map := Dictionary new.
-	aClass protocolsDo: [:category :methods | 
+	aClass protocolsDo: [:category :methods |
 		(category match: '^\*') ifFalse: [ map at: category put: methods ]].
 	(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |
 		methods := map at: category.
@@ -261,7 +261,7 @@ exportMethodsOf: aClass on: aStream
 exportPackageDefinitionOf: package on: aStream
 	"Chunk format."
 
-	aStream 
+	aStream
 		nextPutAll: 'Smalltalk current createPackage: ''', package name, '''!!';
 		lf
 !
@@ -278,7 +278,7 @@ exportPackageExtensionsOf: package on: aStream
 	(Package sortedClasses: Smalltalk current classes) do: [:each |
 		{each. each class} do: [:aClass |
 			map := Dictionary new.
-			aClass protocolsDo: [:category :methods | 
+			aClass protocolsDo: [:category :methods |
 				(category match: '^\*', name) ifTrue: [ map at: category put: methods ]].
 			(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |
 				methods := map at: category.	
@@ -292,23 +292,23 @@ Exporter subclass: #StrippedExporter
 !StrippedExporter methodsFor: 'private'!
 
 exportDefinitionOf: aClass on: aStream
-	aStream 
-	    nextPutAll: 'smalltalk.addClass(';
-	    nextPutAll: '''', (self classNameFor: aClass), ''', ';
-	    nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
-	    nextPutAll: ', ['.
-	aClass instanceVariableNames 
-	    do: [:each | aStream nextPutAll: '''', each, '''']
-	    separatedBy: [aStream nextPutAll: ', '].
-	aStream	
-	    nextPutAll: '], ''';
-	    nextPutAll: aClass category, '''';
-	    nextPutAll: ');'.
+	aStream
+		nextPutAll: 'smalltalk.addClass(';
+		nextPutAll: '''', (self classNameFor: aClass), ''', ';
+		nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
+		nextPutAll: ', ['.
+	aClass instanceVariableNames
+		do: [:each | aStream nextPutAll: '''', each, '''']
+		separatedBy: [aStream nextPutAll: ', '].
+	aStream
+		nextPutAll: '], ''';
+		nextPutAll: aClass category, '''';
+		nextPutAll: ');'.
 	aStream lf
 !
 
 exportMethod: aMethod of: aClass on: aStream
-	aStream 
+	aStream
 		nextPutAll: 'smalltalk.addMethod(';lf;
 		nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
 		nextPutAll: 'smalltalk.method({';lf;
@@ -327,19 +327,19 @@ Object subclass: #Importer
 !Importer methodsFor: 'fileIn'!
 
 import: aStream
-    | chunk result parser lastEmpty |
-    parser := ChunkParser on: aStream.
-    lastEmpty := false.
-    [chunk := parser nextChunk.
-     chunk isNil] whileFalse: [
-        chunk isEmpty
-       		ifTrue: [lastEmpty := true]
-       		ifFalse: [
-        		result := Compiler new evaluateExpression: chunk.
-        		lastEmpty 
-            			ifTrue: [
-                                  	lastEmpty := false.
-                                  	result scanFrom: parser]]]
+	| chunk result parser lastEmpty |
+	parser := ChunkParser on: aStream.
+	lastEmpty := false.
+	[chunk := parser nextChunk.
+	 chunk isNil] whileFalse: [
+		chunk isEmpty
+			ifTrue: [lastEmpty := true]
+			ifFalse: [
+				result := Compiler new evaluateExpression: chunk.
+				lastEmpty
+						ifTrue: [
+									lastEmpty := false.
+									result scanFrom: parser]]]
 ! !
 
 Object subclass: #PackageLoader
@@ -350,30 +350,30 @@ Object subclass: #PackageLoader
 
 initializePackageNamed: packageName prefix: aString
 
-	(Package named: packageName) 
-    	setupClasses;
-        commitPathJs: '/', aString, '/js';
-        commitPathSt: '/', aString, '/st'
+	(Package named: packageName)
+		setupClasses;
+		commitPathJs: '/', aString, '/js';
+		commitPathSt: '/', aString, '/st'
 !
 
 loadPackage: packageName prefix: aString	
 	| url |
-    url := '/', aString, '/js/', packageName, '.js'.
-	jQuery 
+	url := '/', aString, '/js/', packageName, '.js'.
+	jQuery
 		ajax: url
-        options: #{
+		options: #{
 			'type' -> 'GET'.
 			'dataType' -> 'script'.
-    		'complete' -> [ :jqXHR :textStatus | 
-				jqXHR readyState = 4 
-                	ifTrue: [ self initializePackageNamed: packageName prefix: aString ] ].
-			'error' -> [ window alert: 'Could not load package at:  ', url ]
+			'complete' -> [ :jqXHR :textStatus |
+				jqXHR readyState = 4
+					ifTrue: [ self initializePackageNamed: packageName prefix: aString ] ].
+			'error' -> [ window alert: 'Could not load package at:	', url ]
 		}
 !
 
 loadPackages: aCollection prefix: aString
 	aCollection do: [ :each |
-    	self loadPackage: each prefix: aString ]
+		self loadPackage: each prefix: aString ]
 ! !
 
 !PackageLoader class methodsFor: 'not yet classified'!

+ 144 - 144
st/Kernel-Classes.st

@@ -3,13 +3,13 @@ Object subclass: #Behavior
 	instanceVariableNames: ''
 	package: 'Kernel-Classes'!
 !Behavior commentStamp!
-Behavior is the superclass of all class objects. 
+Behavior is the superclass of all class objects.
 
 It defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).
-Instances know about the subclass/superclass relationships between classes, contain the description that instances are created from, 
+Instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,
 and hold the method dictionary that's associated with each class.
 
-Behavior also  provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.!
+Behavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.!
 
 !Behavior methodsFor: 'accessing'!
 
@@ -17,7 +17,7 @@ allInstanceVariableNames
 	| result |
 	result := self instanceVariableNames copy.
 	self superclass ifNotNil: [
-	    result addAll: self superclass allInstanceVariableNames].
+		result addAll: self superclass allInstanceVariableNames].
 	^result
 !
 
@@ -31,39 +31,39 @@ allSubclasses
 	| result |
 	result := self subclasses.
 	self subclasses do: [:each |
-	    result addAll: each allSubclasses].
+		result addAll: each allSubclasses].
 	^result
 !
 
 allSuperclasses
 	
-    self superclass ifNil: [ ^ #() ].
-    
-	^ (OrderedCollection with: self superclass) 
-    	addAll: self superclass allSuperclasses;
-        yourself
+	self superclass ifNil: [ ^ #() ].
+	
+	^ (OrderedCollection with: self superclass)
+		addAll: self superclass allSuperclasses;
+		yourself
 !
 
 comment
-    ^(self basicAt: 'comment') ifNil: ['']
+	^(self basicAt: 'comment') ifNil: ['']
 !
 
 comment: aString
-    self basicAt: 'comment' put: aString.
-    SystemAnnouncer current
-    	announce: (ClassCommentChanged new
-        	theClass: self;
-            yourself)
+	self basicAt: 'comment' put: aString.
+	SystemAnnouncer current
+		announce: (ClassCommentChanged new
+			theClass: self;
+			yourself)
 !
 
 commentStamp
-    ^ClassCommentReader new
+	^ClassCommentReader new
 	class: self;
 	yourself
 !
 
 commentStamp: aStamp prior: prior
-        ^self commentStamp
+		^self commentStamp
 !
 
 definition
@@ -79,12 +79,12 @@ lookupSelector: selector
 	Return the corresponding method if found.
 	Otherwise chase the superclass chain and try again.
 	Return nil if no method is found."
-    
+	
 	| lookupClass |
-    
+	
 	lookupClass := self.
 	[ lookupClass = nil ] whileFalse: [
-      	(lookupClass includesSelector: selector)
+		(lookupClass includesSelector: selector)
 				ifTrue: [ ^ lookupClass methodAt: selector ].
 			lookupClass := lookupClass superclass ].
 	^ nil
@@ -111,8 +111,8 @@ methods
 
 methodsFor: aString
 	^ClassCategoryReader new
-	    class: self category: aString;
-	    yourself
+		class: self category: aString;
+		yourself
 !
 
 methodsFor: aString stamp: aStamp
@@ -133,7 +133,7 @@ organization
 !
 
 protocols
-   ^ self organization elements sorted
+	^ self organization elements sorted
 !
 
 protocolsDo: aBlock
@@ -144,7 +144,7 @@ protocolsDo: aBlock
 	methodsByCategory := HashedCollection new.
 	self methodDictionary values do: [:m |
 		(methodsByCategory at: m category ifAbsentPut: [Array new])
- 			add: m]. 
+			add: m].
 	self protocols do: [:category |
 		aBlock value: category value: (methodsByCategory at: category)]
 !
@@ -181,30 +181,30 @@ withAllSubclasses
 
 addCompiledMethod: aMethod
 	| oldMethod announcement |
-    
-	oldMethod := self methodDictionary 
-    	at: aMethod selector 
-        ifAbsent: [ nil ].
-    
-   (self protocols includes: aMethod protocol)
-   		ifFalse: [ self organization addElement: aMethod protocol ].
-   
+	
+	oldMethod := self methodDictionary
+		at: aMethod selector
+		ifAbsent: [ nil ].
+	
+	(self protocols includes: aMethod protocol)
+		ifFalse: [ self organization addElement: aMethod protocol ].
+
 	self basicAddCompiledMethod: aMethod.
-    
-    announcement := oldMethod 
-    	ifNil: [
-		    MethodAdded new
-		            method: aMethod;
-       			    yourself ]
-    	ifNotNil: [
-          	MethodModified new
-                    oldMethod: oldMethod; 
-		            method: aMethod;
-       			    yourself ].
-                    
-                    
+	
+	announcement := oldMethod
+		ifNil: [
+			MethodAdded new
+					method: aMethod;
+					yourself ]
+		ifNotNil: [
+			MethodModified new
+					oldMethod: oldMethod;
+					method: aMethod;
+					yourself ].
+					
+					
 	SystemAnnouncer current
-		   		announce: announcement
+				announce: announcement
 !
 
 compile: aString
@@ -213,22 +213,22 @@ compile: aString
 
 compile: aString category: anotherString
 	Compiler new
-		install: aString 
-        forClass: self 
-        category: anotherString
+		install: aString
+		forClass: self
+		category: anotherString
 !
 
 removeCompiledMethod: aMethod
 	self basicRemoveCompiledMethod: aMethod.
-    
-    self methods 
-    	detect: [ :each | each protocol = aMethod protocol ]
-  		ifNone: [ self organization removeElement: aMethod protocol ].
-    
-    SystemAnnouncer current
-   		announce: (MethodRemoved new
-            method: aMethod;
-            yourself)
+	
+	self methods
+		detect: [ :each | each protocol = aMethod protocol ]
+		ifNone: [ self organization removeElement: aMethod protocol ].
+	
+	SystemAnnouncer current
+		announce: (MethodRemoved new
+			method: aMethod;
+			yourself)
 ! !
 
 !Behavior methodsFor: 'instance creation'!
@@ -249,9 +249,9 @@ basicAddCompiledMethod: aMethod
 
 basicRemoveCompiledMethod: aMethod
 	<
-    	smalltalk.removeMethod(aMethod)
+		smalltalk.removeMethod(aMethod)
 		smalltalk.init(self);
-    >
+	>
 ! !
 
 !Behavior methodsFor: 'testing'!
@@ -273,7 +273,7 @@ Behavior subclass: #Class
 	instanceVariableNames: ''
 	package: 'Kernel-Classes'!
 !Class commentStamp!
-Class is __the__ class object. 
+Class is __the__ class object.
 
 Instances are the classes of the system.
 Class creation is done throught a `ClassBuilder`!
@@ -286,20 +286,20 @@ category
 
 definition
 	^ String streamContents: [ :stream |
-		stream 
-	    	nextPutAll: self superclass asString;
-	    	nextPutAll: ' subclass: #';
-	    	nextPutAll: self name;
-	    	nextPutAll: String lf, String tab;
-	    	nextPutAll: 'instanceVariableNames: '''.
-		self instanceVariableNames 
-          	do: [ :each | stream nextPutAll: each ] 
-	    	separatedBy: [ stream nextPutAll: ' ' ].
 		stream
-	    	nextPutAll: '''', String lf, String tab;
-	    	nextPutAll: 'package: ''';
-	    	nextPutAll: self category;
-	    	nextPutAll: '''' ]
+			nextPutAll: self superclass asString;
+			nextPutAll: ' subclass: #';
+			nextPutAll: self name;
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'instanceVariableNames: '''.
+		self instanceVariableNames
+			do: [ :each | stream nextPutAll: each ]
+			separatedBy: [ stream nextPutAll: ' ' ].
+		stream
+			nextPutAll: '''', String lf, String tab;
+			nextPutAll: 'package: ''';
+			nextPutAll: self category;
+			nextPutAll: '''' ]
 !
 
 package
@@ -334,7 +334,7 @@ subclass: aString instanceVariableNames: aString2 classVariableNames: classVars
 
 subclass: aString instanceVariableNames: aString2 package: aString3
 	^ClassBuilder new
-	    superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
+		superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
 ! !
 
 !Class methodsFor: 'converting'!
@@ -361,20 +361,20 @@ Behavior subclass: #Metaclass
 !Metaclass commentStamp!
 Metaclass is the root of the class hierarchy.
 
-Metaclass instances are metaclasses, one for each real class. 
+Metaclass instances are metaclasses, one for each real class.
 Metaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of.!
 
 !Metaclass methodsFor: 'accessing'!
 
 definition
 	^ String streamContents: [ :stream |
-		stream 
-	   	 	nextPutAll: self asString;
-	    	nextPutAll: ' class ';
-	    	nextPutAll: 'instanceVariableNames: '''.
+		stream
+			nextPutAll: self asString;
+			nextPutAll: ' class ';
+			nextPutAll: 'instanceVariableNames: '''.
 		self instanceVariableNames
-	    	do: [ :each | stream nextPutAll: each ]
-	    	separatedBy: [ stream nextPutAll: ' ' ].
+			do: [ :each | stream nextPutAll: each ]
+			separatedBy: [ stream nextPutAll: ' ' ].
 		stream nextPutAll: '''' ]
 !
 
@@ -384,7 +384,7 @@ instanceClass
 
 instanceVariableNames: aCollection
 	ClassBuilder new
-	    class: self instanceVariableNames: aCollection
+		class: self instanceVariableNames: aCollection
 !
 
 theMetaClass
@@ -430,33 +430,33 @@ instanceVariableNamesFor: aString
 !ClassBuilder methodsFor: 'class definition'!
 
 addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
-    | theClass |
-    
-    theClass := Smalltalk current at: aString.
-    
-   	theClass ifNotNil: [ 
-    	theClass superclass == aClass ifFalse: [
-    		^ self 
-        		migrateClassNamed: aString 
-           	 	superclass: aClass 
-           	 	instanceVariableNames: aCollection 
-            	package: packageName ] ].
-
-	^ self 
-    	basicAddSubclassOf: aClass 
-        named: aString 
-        instanceVariableNames: aCollection 
-        package: packageName
+	| theClass |
+	
+	theClass := Smalltalk current at: aString.
+	
+	theClass ifNotNil: [
+		theClass superclass == aClass ifFalse: [
+			^ self
+				migrateClassNamed: aString
+				superclass: aClass
+				instanceVariableNames: aCollection
+				package: packageName ] ].
+
+	^ self
+		basicAddSubclassOf: aClass
+		named: aString
+		instanceVariableNames: aCollection
+		package: packageName
 !
 
 class: aClass instanceVariableNames: aString
 	self basicClass: aClass instanceVariableNames: aString.
-    self setupClass: aClass.
-    
-    SystemAnnouncer current
-    	announce: (ClassDefinitionChanged new
-        	theClass: aClass;
-            yourself)
+	self setupClass: aClass.
+	
+	SystemAnnouncer current
+		announce: (ClassDefinitionChanged new
+			theClass: aClass;
+			yourself)
 !
 
 superclass: aClass subclass: aString
@@ -466,16 +466,16 @@ superclass: aClass subclass: aString
 superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
 	| newClass |
 	
-    newClass := self addSubclassOf: aClass
+	newClass := self addSubclassOf: aClass
 		named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
 		package: (aString3 ifNil: ['unclassified']).
 	self setupClass: newClass.
-    
-    SystemAnnouncer current 
-    	announce: (ClassAdded new
-        	theClass: newClass;
-            yourself).
-    
+	
+	SystemAnnouncer current
+		announce: (ClassAdded new
+			theClass: newClass;
+			yourself).
+	
 	^newClass
 ! !
 
@@ -483,20 +483,20 @@ superclass: aClass subclass: aString instanceVariableNames: aString2 package: aS
 
 migrateClass: aClass superclass: anotherClass
 	console log: aClass name.
-	self 
-    	migrateClassNamed: aClass name
-        superclass: anotherClass
-        instanceVariableNames: aClass instanceVariableNames
-        package: aClass package name
+	self
+		migrateClassNamed: aClass name
+		superclass: anotherClass
+		instanceVariableNames: aClass instanceVariableNames
+		package: aClass package name
 !
 
 migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName
 	| oldClass newClass tmp |
-    
-    tmp := 'new*', aString.
-    oldClass := Smalltalk current at: aString.
-    
-    newClass := self 
+	
+	tmp := 'new*', aString.
+	oldClass := Smalltalk current at: aString.
+	
+	newClass := self
 		addSubclassOf: aClass
 		named: tmp
 		instanceVariableNames: aCollection
@@ -508,28 +508,28 @@ migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection
 		on: Error
 		do: [ :exception |
 			self
-            	basicSwapClassNames: oldClass with: newClass;
-            	basicRemoveClass: newClass.
-            exception signal ].
+				basicSwapClassNames: oldClass with: newClass;
+				basicRemoveClass: newClass.
+			exception signal ].
 
 	self
 		rawRenameClass: oldClass to: tmp;
-        rawRenameClass: newClass to: aString.
+		rawRenameClass: newClass to: aString.
 
 	oldClass subclasses do: [ :each |
-    	self migrateClass: each superclass: newClass ].
+		self migrateClass: each superclass: newClass ].
 
-    self basicRemoveClass: oldClass.
+	self basicRemoveClass: oldClass.
 	^newClass
 !
 
 renameClass: aClass to: aString
 	self basicRenameClass: aClass to: aString.
-    
-    SystemAnnouncer current
-    	announce: (ClassRenamed new
-        	theClass: aClass;
-            yourself)
+	
+	SystemAnnouncer current
+		announce: (ClassRenamed new
+			theClass: aClass;
+			yourself)
 ! !
 
 !ClassBuilder methodsFor: 'copying'!
@@ -537,14 +537,14 @@ renameClass: aClass to: aString
 copyClass: aClass named: aString
 	| newClass |
 
-	newClass := self 
+	newClass := self
 		addSubclassOf: aClass superclass
-		named: aString 
-		instanceVariableNames: aClass instanceVariableNames 
+		named: aString
+		instanceVariableNames: aClass instanceVariableNames
 		package: aClass package name.
 
 	self copyClass: aClass to: newClass.
-    
+	
 	^newClass
 !
 
@@ -568,7 +568,7 @@ copyClass: aClass to: anotherClass
 installMethod: aCompiledMethod forClass: aBehavior category: aString
 	aCompiledMethod category: aString.
 	aBehavior addCompiledMethod: aCompiledMethod.
-    self setupClass: aBehavior.
+	self setupClass: aBehavior.
 	^aCompiledMethod
 ! !
 
@@ -607,7 +607,7 @@ basicSwapClassNames: aClass with: anotherClass
 	<
 		var tmp = aClass.className;
 		aClass.className = anotherClass.className;
-        anotherClass.className = tmp;
+		anotherClass.className = tmp;
 	>
 !
 
@@ -642,7 +642,7 @@ scanFrom: aChunkParser
 	| chunk |
 	[chunk := aChunkParser nextChunk.
 	chunk isEmpty] whileFalse: [
-	    self compileMethod: chunk].
+		self compileMethod: chunk].
 	ClassBuilder new setupClass: class
 ! !
 
@@ -677,7 +677,7 @@ scanFrom: aChunkParser
 	| chunk |
 	chunk := aChunkParser nextChunk.
 	chunk isEmpty ifFalse: [
-	    self setComment: chunk].
+		self setComment: chunk].
 ! !
 
 !ClassCommentReader methodsFor: 'initialization'!
@@ -689,7 +689,7 @@ initialize
 !ClassCommentReader methodsFor: 'private'!
 
 setComment: aString
-    class comment: aString
+	class comment: aString
 ! !
 
 Object subclass: #ClassSorterNode

+ 99 - 99
st/Kernel-Collections.st

@@ -29,7 +29,7 @@ value: aValue
 
 = anAssociation
 	^self class = anAssociation class and: [
-	    self key = anAssociation key and: [
+		self key = anAssociation key and: [
 		self value = anAssociation value]]
 ! !
 
@@ -52,7 +52,7 @@ storeOn: aStream
 !Association class methodsFor: 'instance creation'!
 
 key: aKey value: aValue
-	    ^self new
+		^self new
 		key: aKey;
 		value: aValue;
 		yourself
@@ -68,7 +68,7 @@ I provide a set of useful methods to the Collectiohn hierarchy such as enumerati
 
 !Collection methodsFor: 'accessing'!
 
-occurrencesOf: anObject 
+occurrencesOf: anObject
 	"Answer how many of the receiver's elements are equal to anObject."
 
 	| tally |
@@ -105,16 +105,16 @@ add: anObject
 
 addAll: aCollection
 	aCollection do: [:each |
-	    self add: each].
+		self add: each].
 	^aCollection
 !
 
 remove: anObject
-    ^self remove: anObject ifAbsent: [self errorNotFound]
+	^self remove: anObject ifAbsent: [self errorNotFound]
 !
 
 remove: anObject ifAbsent: aBlock
-    self subclassResponsibility
+	self subclassResponsibility
 ! !
 
 !Collection methodsFor: 'converting'!
@@ -138,9 +138,9 @@ asSet
 !Collection methodsFor: 'copying'!
 
 , aCollection
-	^self copy 
-	    addAll: aCollection; 
-	    yourself
+	^self copy
+		addAll: aCollection;
+		yourself
 !
 
 copyWith: anObject
@@ -152,7 +152,7 @@ copyWithAll: aCollection
 !
 
 copyWithoutAll: aCollection
-	"Answer a copy of the receiver that does not contain any elements 
+	"Answer a copy of the receiver that does not contain any elements
 	equal to those in aCollection."
 
 	^ self reject: [:each | aCollection includes: each]
@@ -184,15 +184,15 @@ do: aBlock separatedBy: anotherBlock
 	| actionBeforeElement |
 	actionBeforeElement := [actionBeforeElement := anotherBlock].
 	self do: [:each |
-    	actionBeforeElement value.
-	    aBlock value: each]
+		actionBeforeElement value.
+		aBlock value: each]
 !
 
 inject: anObject into: aBlock
 	| result |
 	result := anObject.
-	self do: [:each | 
-	    result := aBlock value: result value: each].
+	self do: [:each |
+		result := aBlock value: result value: each].
 	^result
 !
 
@@ -206,7 +206,7 @@ intersection: aCollection
 	
 	aCollection do: [ :each |
 		((set includes: each) and: [(outputSet includes: each) not])
-			ifTrue: [ 
+			ifTrue: [
 				outputSet add: each]].
 		
 	^ self class withAll: outputSet asArray
@@ -220,7 +220,7 @@ select: aBlock
 	| stream |
 	stream := self class new writeStream.
 	self do: [:each |
-	    (aBlock value: each) ifTrue: [
+		(aBlock value: each) ifTrue: [
 		stream nextPut: each]].
 	^stream contents
 ! !
@@ -246,9 +246,9 @@ printString
 !Collection methodsFor: 'testing'!
 
 ifEmpty: aBlock
-	"Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs: 
+	"Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs:
 		(myProtocol ifEmpty: ['As yet unclassified'])"
-	^ self isEmpty 
+	^ self isEmpty
 		ifTrue: [ aBlock value ]
 		ifFalse: [ self ]
 !
@@ -259,8 +259,8 @@ ifNotEmpty: aBlock
 
 includes: anObject
 	| sentinel |
-    sentinel := Object new.
-    ^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel
+	sentinel := Object new.
+	^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel
 !
 
 isEmpty
@@ -274,7 +274,7 @@ notEmpty
 !Collection class methodsFor: 'accessing'!
 
 streamClass
-	    ^Stream
+		^Stream
 ! !
 
 !Collection class methodsFor: 'instance creation'!
@@ -284,20 +284,20 @@ new: anInteger
 !
 
 with: anObject
-	    ^self new
+		^self new
 		add: anObject;
 		yourself
 !
 
 with: anObject with: anotherObject
-	    ^self new
+		^self new
 		add: anObject;
 		add: anotherObject;
 		yourself
 !
 
 with: firstObject with: secondObject with: thirdObject
-	    ^self new
+		^self new
 		add: firstObject;
 		add: secondObject;
 		add: thirdObject;
@@ -305,7 +305,7 @@ with: firstObject with: secondObject with: thirdObject
 !
 
 withAll: aCollection
-	    ^self new
+		^self new
 		addAll: aCollection;
 		yourself
 ! !
@@ -323,31 +323,31 @@ it is an IndexableCollection.!
 !IndexableCollection methodsFor: 'accessing'!
 
 at: anIndex
-	"Lookup the given index in the receiver. 
-	If it is present, answer the value stored at anIndex. 
+	"Lookup the given index in the receiver.
+	If it is present, answer the value stored at anIndex.
 	Otherwise, raise an error."
 
 	^self at: anIndex ifAbsent: [ self errorNotFound ]
 !
 
 at: anIndex ifAbsent: aBlock
-	"Lookup the given index in the receiver. 
-	If it is present, answer the value stored at anIndex. 
+	"Lookup the given index in the receiver.
+	If it is present, answer the value stored at anIndex.
 	Otherwise, answer the value of aBlock."
 
 	self subclassReponsibility
 !
 
 at: anIndex ifPresent: aBlock
-	"Lookup the given index in the receiver. 
-	If it is present, answer the value of evaluating aBlock with the value stored at anIndex. 
+	"Lookup the given index in the receiver.
+	If it is present, answer the value of evaluating aBlock with the value stored at anIndex.
 	Otherwise, answer nil."
 
 	^self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]
 !
 
 at: anIndex ifPresent: aBlock ifAbsent: anotherBlock
-	"Lookup the given index in the receiver. 
+	"Lookup the given index in the receiver.
 	If it is present, answer the value of evaluating aBlock with the value stored at anIndex.
 	Otherwise, answer the value of anotherBlock."
 
@@ -404,7 +404,7 @@ Unlike a `Dictionary`, it can only have strings as keys.!
 associations
 	| associations |
 	associations := #().
-	self associationsDo: [:each |  associations add: each].
+	self associationsDo: [:each | associations add: each].
 	^associations
 !
 
@@ -416,12 +416,12 @@ at: aKey ifAbsent: aBlock
 
 at: aKey ifAbsentPut: aBlock
 	^self at: aKey ifAbsent: [
-	    self at: aKey put: aBlock value]
+		self at: aKey put: aBlock value]
 !
 
 at: aKey ifPresent: aBlock ifAbsent: anotherBlock
-	"Lookup the given key in the receiver. 
-	If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, 
+	"Lookup the given key in the receiver.
+	If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key,
 	otherwise answer the value of absentBlock."
 	^(self includesKey: aKey)
 		ifTrue: [ aBlock value: (self at: aKey) ]
@@ -470,15 +470,15 @@ addAll: aHashedCollection
 !
 
 remove: aKey ifAbsent: aBlock
-    ^self removeKey: aKey ifAbsent: aBlock
+	^self removeKey: aKey ifAbsent: aBlock
 !
 
 removeKey: aKey
-    ^self remove: aKey
+	^self remove: aKey
 !
 
 removeKey: aKey ifAbsent: aBlock
-	^(self includesKey: aKey) 
+	^(self includesKey: aKey)
 		ifFalse: [aBlock value]
 		ifTrue: [self basicDelete: aKey]
 ! !
@@ -515,7 +515,7 @@ deepCopy
 	| copy |
 	copy := self class new.
 	self keysAndValuesDo: [:key :value |
-	    copy at: key  put: value deepCopy].
+		copy at: key put: value deepCopy].
 	^copy
 !
 
@@ -523,7 +523,7 @@ shallowCopy
 	| copy |
 	copy := self class new.
 	self keysAndValuesDo: [:key :value |
-	    copy at: key  put: value].
+		copy at: key put: value].
 	^copy
 ! !
 
@@ -531,14 +531,14 @@ shallowCopy
 
 associationsDo: aBlock
 	self keysAndValuesDo: [:key :value |
-	    aBlock value: (Association key: key value: value)]
+		aBlock value: (Association key: key value: value)]
 !
 
 collect: aBlock
 	| newDict |
 	newDict := self class new.
 	self keysAndValuesDo: [:key :value |
-	    newDict at: key put: (aBlock value: value)].
+		newDict at: key put: (aBlock value: value)].
 	^newDict
 !
 
@@ -556,7 +556,7 @@ includes: anObject
 
 keysAndValuesDo: aBlock
 	self keysDo: [:each |
-	    aBlock value: each value: (self at: each)]
+		aBlock value: each value: (self at: each)]
 !
 
 keysDo: aBlock
@@ -567,7 +567,7 @@ select: aBlock
 	| newDict |
 	newDict := self class new.
 	self keysAndValuesDo: [:key :value |
-	    (aBlock value: value) ifTrue: [newDict at: key put: value]].
+		(aBlock value: value) ifTrue: [newDict at: key put: value]].
 	^newDict
 !
 
@@ -618,8 +618,8 @@ HashedCollection subclass: #Dictionary
 	instanceVariableNames: 'keys values'
 	package: 'Kernel-Collections'!
 !Dictionary commentStamp!
-I represent a set of elements that can be viewed from one of two perspectives: a set of associations, 
-or a container of values that are externally named where the name can be any object that responds to `=`. 
+I represent a set of elements that can be viewed from one of two perspectives: a set of associations,
+or a container of values that are externally named where the name can be any object that responds to `=`.
 
 The external name is referred to as the key.!
 
@@ -648,8 +648,8 @@ at: aKey put: aValue
 indexOf: anObject ifAbsent: aBlock
 
 	| index |
-    index := values indexOf: anObject ifAbsent: [0].
-    ^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]
+	index := values indexOf: anObject ifAbsent: [0].
+	^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]
 !
 
 keys
@@ -776,7 +776,7 @@ indexOf: anObject ifAbsent: aBlock
 
 indexOf: anObject startingAt: start
 	"Answer the index of the first occurence of anElement after start
-	within the receiver. If the receiver does not contain anElement, 
+	within the receiver. If the receiver does not contain anElement,
 	answer 0."
 	^self indexOf: anObject startingAt: start ifAbsent: [0]
 !
@@ -818,7 +818,7 @@ removeLast
 	(self class = aCollection class and: [
 		self size = aCollection size]) ifFalse: [^false].
 	self withIndexDo: [:each :i |
-                 (aCollection at: i) = each ifFalse: [^false]].
+				 (aCollection at: i) = each ifFalse: [^false]].
 	^true
 ! !
 
@@ -835,14 +835,14 @@ copyFrom: anIndex to: anotherIndex
 	range := anIndex to: anotherIndex.
 	newCollection := self class new: range size.
 	range withIndexDo: [:each :i |
-	    newCollection at: i put: (self at: each)].
+		newCollection at: i put: (self at: each)].
 	^newCollection
 !
 
 deepCopy
 	| newCollection |
 	newCollection := self class new: self size.
-	self withIndexDo: [:each :index | 
+	self withIndexDo: [:each :index |
 		newCollection at: index put: each deepCopy].
 	^newCollection
 !
@@ -850,7 +850,7 @@ deepCopy
 shallowCopy
 	| newCollection |
 	newCollection := self class new: self size.
-	self withIndexDo: [ :each :index | 
+	self withIndexDo: [ :each :index |
 		newCollection at: index put: each].
 	^newCollection
 ! !
@@ -922,7 +922,7 @@ remove: anObject ifAbsent: aBlock
 				return self;
 			}
 		};
-        aBlock._value();
+		aBlock._value();
 	>
 !
 
@@ -933,7 +933,7 @@ removeFrom: aNumber to: anotherNumber
 !Array methodsFor: 'converting'!
 
 asJavascript
-	^'[', ((self collect: [:each | each asJavascript]) join: ', '),  ']'
+	^'[', ((self collect: [:each | each asJavascript]) join: ', '),	 ']'
 !
 
 reversed
@@ -947,7 +947,7 @@ join: aString
 !
 
 sort
-    ^self basicPerform: 'sort'
+	^self basicPerform: 'sort'
 !
 
 sort: aBlock
@@ -973,20 +973,20 @@ new: anInteger
 !
 
 with: anObject
-	    ^(self new: 1)
+		^(self new: 1)
 		at: 1 put: anObject;
 		yourself
 !
 
 with: anObject with: anObject2
-	    ^(self new: 2)
+		^(self new: 2)
 		at: 1 put: anObject;
 		at: 2 put: anObject2;
 		yourself
 !
 
 with: anObject with: anObject2 with: anObject3
-	    ^(self new: 3)
+		^(self new: 3)
 		at: 1 put: anObject;
 		at: 2 put: anObject2;
 		at: 3 put: anObject3;
@@ -997,7 +997,7 @@ withAll: aCollection
 	| instance index |
 	index := 1.
 	instance := self new: aCollection size.
-	aCollection do: [:each  |
+	aCollection do: [:each	|
 		instance at: index put: each.
 		index := index + 1].
 	^instance
@@ -1114,11 +1114,11 @@ unescaped
 
 = aString
 	<
-    	if(!! aString._isString || !! aString._isString()) {
-        	return false;
-        }
-    	return String(self) === String(aString)
-    >
+		if(!! aString._isString || !! aString._isString()) {
+			return false;
+		}
+		return String(self) === String(aString)
+	>
 !
 
 == aString
@@ -1233,7 +1233,7 @@ match: aRegexp
 !
 
 matchesOf: aRegularExpression
-      <return self.match(aRegularExpression)>
+	<return self.match(aRegularExpression)>
 !
 
 replace: aString with: anotherString
@@ -1273,10 +1273,10 @@ trimRight: separators
 
 !String methodsFor: 'split join'!
 
-join: aCollection 
+join: aCollection
 	^ String
 		streamContents: [:stream | aCollection
-				do: [:each | stream nextPutAll: each asString] 
+				do: [:each | stream nextPutAll: each asString]
 				separatedBy: [stream nextPutAll: self]]
 !
 
@@ -1371,7 +1371,7 @@ space
 !
 
 streamClass
-	    ^StringStream
+		^StringStream
 !
 
 tab
@@ -1385,7 +1385,7 @@ fromCharCode: anInteger
 !
 
 fromString: aString
-	    <return new self.fn(aString)>
+		<return new self.fn(aString)>
 !
 
 streamContents: blockWithArg
@@ -1404,7 +1404,7 @@ CharacterArray subclass: #Symbol
 	instanceVariableNames: ''
 	package: 'Kernel-Collections'!
 !Symbol commentStamp!
-I represent Strings that are created uniquely. 
+I represent Strings that are created uniquely.
 Symbols are unique through the system.
 
 Thus, someString asSymbol == someString asSymbol.!
@@ -1506,7 +1506,7 @@ withIndexDo: aBlock
 
 !Symbol methodsFor: 'evaluating'!
 
-value: anObject 
+value: anObject
 	^anObject perform: self
 ! !
 
@@ -1569,7 +1569,7 @@ remove: anObject
 
 = aCollection
 	self class = aCollection class ifFalse: [ ^ false ].
-    self size = aCollection size ifFalse: [ ^ false ].
+	self size = aCollection size ifFalse: [ ^ false ].
 	self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].
 	^ true
 ! !
@@ -1596,7 +1596,7 @@ do: aBlock
 
 select: aBlock
 	| collection |
-	collection := self class new. 
+	collection := self class new.
 	self do: [:each |
 		(aBlock value: each) ifTrue: [
 			collection add: each]].
@@ -1637,7 +1637,7 @@ back: anObject
 !
 
 front
-    ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.' ]
+	^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.' ]
 !
 
 frontIfAbsent: aBlock
@@ -1646,13 +1646,13 @@ frontIfAbsent: aBlock
 		write isEmpty ifTrue: [
 			readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].
 			^aBlock value ].
-    	read := write.
-    	readIndex := 1.
-    	write := OrderedCollection new.
-    	read first ].
-    read at: readIndex put: nil.
-    readIndex := readIndex + 1.
-    ^result
+		read := write.
+		readIndex := 1.
+		write := OrderedCollection new.
+		read first ].
+	read at: readIndex put: nil.
+	readIndex := readIndex + 1.
+	^result
 ! !
 
 !Queue methodsFor: 'initialization'!
@@ -1660,8 +1660,8 @@ frontIfAbsent: aBlock
 initialize
 	super initialize.
 	read := OrderedCollection new.
-    write := OrderedCollection new.
-    readIndex := 1
+	write := OrderedCollection new.
+	readIndex := 1
 ! !
 
 Object subclass: #RegularExpression
@@ -1687,7 +1687,7 @@ test: aString
 !RegularExpression class methodsFor: 'instance creation'!
 
 fromString: aString
-	    ^self fromString: aString flag: ''
+		^self fromString: aString flag: ''
 !
 
 fromString: aString flag: anotherString
@@ -1709,8 +1709,8 @@ collection
 
 contents
 	^self collection
-	    copyFrom: 1 
-	    to: self streamSize
+		copyFrom: 1
+		to: self streamSize
 !
 
 position
@@ -1773,10 +1773,10 @@ skip: anInteger
 !Stream methodsFor: 'reading'!
 
 next
-	^self atEnd 
+	^self atEnd
 		ifTrue: [nil]
 		ifFalse: [
-			self position: self position + 1. 
+			self position: self position + 1.
 			collection at: self position]
 !
 
@@ -1784,14 +1784,14 @@ next: anInteger
 	| tempCollection |
 	tempCollection := self collection class new.
 	anInteger timesRepeat: [
-	    self atEnd ifFalse: [
+		self atEnd ifFalse: [
 		tempCollection add: self next]].
 	^tempCollection
 !
 
 peek
 	^self atEnd ifFalse: [
-	    self collection at: self position + 1]
+		self collection at: self position + 1]
 ! !
 
 !Stream methodsFor: 'testing'!
@@ -1818,13 +1818,13 @@ nextPut: anObject
 
 nextPutAll: aCollection
 	aCollection do: [:each |
-	    self nextPut: each]
+		self nextPut: each]
 ! !
 
 !Stream class methodsFor: 'instance creation'!
 
 on: aCollection
-	    ^self new 
+		^self new
 		setCollection: aCollection;
 		setStreamSize: aCollection size;
 		yourself
@@ -1842,7 +1842,7 @@ next: anInteger
 	| tempCollection |
 	tempCollection := self collection class new.
 	anInteger timesRepeat: [
-	    self atEnd ifFalse: [
+		self atEnd ifFalse: [
 		tempCollection := tempCollection, self next]].
 	^tempCollection
 ! !
@@ -1866,10 +1866,10 @@ nextPut: aString
 !
 
 nextPutAll: aString
-	self setCollection: 
-	    (self collection copyFrom: 1 to: self position),
-	    aString,
-	    (self collection copyFrom: (self position + 1 + aString size) to: self collection size).
+	self setCollection:
+		(self collection copyFrom: 1 to: self position),
+		aString,
+		(self collection copyFrom: (self position + 1 + aString size) to: self collection size).
 	self position: self position + aString size.
 	self setStreamSize: (self streamSize max: self position)
 !

+ 13 - 13
st/Kernel-Exceptions.st

@@ -5,10 +5,10 @@ Object subclass: #Error
 !Error commentStamp!
 From the ANSI standard:
 
-This protocol describes the behavior of instances of class `Error`. 
-These are used to represent error conditions that prevent the normal continuation of processing. 
+This protocol describes the behavior of instances of class `Error`.
+These are used to represent error conditions that prevent the normal continuation of processing.
 Actual error exceptions used by an application may be subclasses of this class.
-As `Error` is explicitly specified  to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.!
+As `Error` is explicitly specified	to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.!
 
 !Error methodsFor: 'accessing'!
 
@@ -58,7 +58,7 @@ signal
 !
 
 signal: aString
-	    ^self new
+		^self new
 		signal: aString
 ! !
 
@@ -73,9 +73,9 @@ See `boot.js` `inContext()` and `BlockClosure >> on:do:`!
 
 context: aMethodContext
 	"Set the context from the outside.
-    See boot.js `inContext()` exception handling"
-    
-    <self.context = aMethodContext>
+	See boot.js `inContext()` exception handling"
+	
+	<self.context = aMethodContext>
 !
 
 exception
@@ -94,15 +94,15 @@ messageText
 
 on: anException
 	^ self new
-    	exception: anException;
-        yourself
+		exception: anException;
+		yourself
 !
 
 on: anException context: aMethodContext
 	^ self new
-    	exception: anException;
-        context: aMethodContext;
-        yourself
+		exception: anException;
+		context: aMethodContext;
+		yourself
 ! !
 
 Error subclass: #MessageNotUnderstood
@@ -153,7 +153,7 @@ Object subclass: #ErrorHandler
 	instanceVariableNames: ''
 	package: 'Kernel-Exceptions'!
 !ErrorHandler commentStamp!
-ErrorHandler is used to manage Smalltalk errors. 
+ErrorHandler is used to manage Smalltalk errors.
 See `boot.js` `handleError()` function.
 
 Subclasses of `ErrorHandler` can register themselves as the current handler with

+ 86 - 86
st/Kernel-Methods.st

@@ -48,16 +48,16 @@ asCompiledMethod: aString
 
 currySelf
 	"Transforms [ :selfarg :x :y | stcode ] block
-    which represents JS function (selfarg, x, y, ...) {jscode}
-    into function (x, y, ...) {jscode} that takes selfarg from 'this'.
-    IOW, it is usable as JS method and first arg takes the receiver."
-    
-    <
-    	return function () {
-    		var args = [ this ];
-        	args.push.apply(args, arguments);
-        	return self.apply(null, args);
-    	}
+	which represents JS function (selfarg, x, y, ...) {jscode}
+	into function (x, y, ...) {jscode} that takes selfarg from 'this'.
+	IOW, it is usable as JS method and first arg takes the receiver."
+	
+	<
+		return function () {
+			var args = [ this ];
+			args.push.apply(args, arguments);
+			return self.apply(null, args);
+		}
 	>
 ! !
 
@@ -65,13 +65,13 @@ currySelf
 
 on: anErrorClass do: aBlock
 	"All exceptions thrown in the Smalltalk stack are cought.
-    Convert all JS exceptions to JavaScriptException instances."
-    
+	Convert all JS exceptions to JavaScriptException instances."
+	
 	^self try: self catch: [ :error | | smalltalkError |
-    	smalltalkError := Smalltalk current asSmalltalkException: error.
-	    (smalltalkError isKindOf: anErrorClass) 
-	     ifTrue: [ aBlock value: smalltalkError ]
-	     ifFalse: [ smalltalkError signal ] ]
+		smalltalkError := Smalltalk current asSmalltalkException: error.
+		(smalltalkError isKindOf: anErrorClass)
+		 ifTrue: [ aBlock value: smalltalkError ]
+		 ifFalse: [ smalltalkError signal ] ]
 ! !
 
 !BlockClosure methodsFor: 'evaluating'!
@@ -85,25 +85,25 @@ ensure: aBlock
 !
 
 new
-	"Use the receiver as a JS constructor. 
+	"Use the receiver as a JS constructor.
 	*Do not* use this method to instanciate Smalltalk objects!!"
 	<return new self()>
 !
 
 newValue: anObject
-	"Use the receiver as a JS constructor. 
+	"Use the receiver as a JS constructor.
 	*Do not* use this method to instanciate Smalltalk objects!!"
 	<return new self(anObject)>
 !
 
-newValue:  anObject value: anObject2
-	"Use the receiver as a JS constructor. 
+newValue: anObject value: anObject2
+	"Use the receiver as a JS constructor.
 	*Do not* use this method to instanciate Smalltalk objects!!"
 	<return new self(anObject, anObject2)>
 !
 
-newValue:  anObject value: anObject2 value: anObject3
-	"Use the receiver as a JS constructor. 
+newValue: anObject value: anObject2 value: anObject3
+	"Use the receiver as a JS constructor.
 	*Do not* use this method to instanciate Smalltalk objects!!"
 	<return new self(anObject, anObject2,anObject3)>
 !
@@ -146,16 +146,16 @@ fork
 
 valueWithInterval: aNumber
 	<
-    	var interval = setInterval(self, aNumber);
-    	return smalltalk.Timeout._on_(interval);
-    >
+		var interval = setInterval(self, aNumber);
+		return smalltalk.Timeout._on_(interval);
+	>
 !
 
 valueWithTimeout: aNumber
 	<
-    	var timeout = setTimeout(self, aNumber);
-    	return smalltalk.Timeout._on_(timeout);
-    >
+		var timeout = setTimeout(self, aNumber);
+		return smalltalk.Timeout._on_(timeout);
+	>
 ! !
 
 Object subclass: #CompiledMethod
@@ -178,7 +178,7 @@ See referenced classes:
 
 or messages sent from this method:
 	
-	(String methodAt: 'lines')  messageSends!
+	(String methodAt: 'lines')	messageSends!
 
 !CompiledMethod methodsFor: 'accessing'!
 
@@ -192,15 +192,15 @@ category
 
 category: aString
 	| oldCategory |
-    oldCategory := self category.
+	oldCategory := self category.
 	self basicAt: 'category' put: aString.
-    
-    self methodClass ifNotNil: [
-    	self methodClass organization addElement: aString.
-    
-		(self methodClass methods 
-    		select: [ :each | each category = oldCategory ])
-        	ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]
+	
+	self methodClass ifNotNil: [
+		self methodClass organization addElement: aString.
+	
+		(self methodClass methods
+			select: [ :each | each category = oldCategory ])
+			ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]
 !
 
 fn
@@ -284,28 +284,28 @@ defaultMaxPoolSize
 !ForkPool methodsFor: 'initialization'!
 
 initialize
-    super initialize.
-    
+	super initialize.
+	
 	poolSize := 0.
-    queue := Queue new.
-    worker := self makeWorker
+	queue := Queue new.
+	worker := self makeWorker
 !
 
 makeWorker
 	| sentinel |
-    sentinel := Object new.
-    ^[ | block |
-        poolSize := poolSize - 1.
+	sentinel := Object new.
+	^[ | block |
+		poolSize := poolSize - 1.
 		block := queue frontIfAbsent: [ sentinel ].
-        block == sentinel ifFalse: [
-        	[ block value ] ensure: [ self addWorker ]]]
+		block == sentinel ifFalse: [
+			[ block value ] ensure: [ self addWorker ]]]
 ! !
 
 !ForkPool methodsFor: 'private'!
 
 addWorker
 	worker valueWithTimeout: 0.
-    poolSize := poolSize + 1
+	poolSize := poolSize + 1
 ! !
 
 ForkPool class instanceVariableNames: 'default'!
@@ -329,10 +329,10 @@ Object subclass: #Message
 	package: 'Kernel-Methods'!
 !Message commentStamp!
 Generally, the system does not use instances of Message for efficiency reasons.
-However, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission. 
+However, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.
 This instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.
 
-See boot.js, `messageNotUnderstood`  and its counterpart `Object>>doesNotUnderstand:`!
+See boot.js, `messageNotUnderstood`	 and its counterpart `Object>>doesNotUnderstand:`!
 
 !Message methodsFor: 'accessing'!
 
@@ -355,12 +355,12 @@ selector: aString
 !Message methodsFor: 'printing'!
 
 printString
-	^ String streamContents: [:aStream|  
-                                  				aStream 
-                                  					nextPutAll: super printString;
-                                  					nextPutAll: '(';
-                                  					nextPutAll: selector;
-                                  					nextPutAll: ')' 				]
+	^ String streamContents: [:aStream| 
+												aStream
+													nextPutAll: super printString;
+													nextPutAll: '(';
+													nextPutAll: selector;
+													nextPutAll: ')'					]
 !
 
 sendTo: anObject
@@ -381,7 +381,7 @@ Object subclass: #MethodContext
 	package: 'Kernel-Methods'!
 !MethodContext commentStamp!
 MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.
-  
+
 MethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js!
 
 !MethodContext methodsFor: 'accessing'!
@@ -400,8 +400,8 @@ method
 
 methodContext
 	self isBlockContext ifFalse: [ ^ self ].
-    
-    ^ self home
+	
+	^ self home
 !
 
 outerContext
@@ -422,33 +422,33 @@ receiver
 
 selector
 	<
-    	if(self.selector) {
-        	return smalltalk.convertSelector(self.selector);
-        } else {
-        	return nil;
-        }
-    >
+		if(self.selector) {
+			return smalltalk.convertSelector(self.selector);
+		} else {
+			return nil;
+		}
+	>
 !
 
 temps
 	self deprecatedAPI.
-    
+	
 	^ self locals
 ! !
 
 !MethodContext methodsFor: 'converting'!
 
 asString
-	^self isBlockContext 
-    	ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]
-      	ifFalse: [ self receiver class printString, ' >> ', self selector ]
+	^self isBlockContext
+		ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]
+		ifFalse: [ self receiver class printString, ' >> ', self selector ]
 ! !
 
 !MethodContext methodsFor: 'testing'!
 
 isBlockContext
 	"Block context do not have selectors."
-    
+	
 	^ self selector isNil
 ! !
 
@@ -465,37 +465,37 @@ Created instances will most probably be instance of `JSObjectProxy`.
 
 Usage example:
 
-    | ws |
-    ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.
-    ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]!
+	| ws |
+	ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.
+	ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]!
 
 !NativeFunction class methodsFor: 'instance creation'!
 
 constructor: aString
 	<
-    	var native=eval(aString); 
-        return new native();
+		var native=eval(aString);
+		return new native();
 	>
 !
 
 constructor: aString value:anObject
 	<
-    	var native=eval(aString); 
-        return new native(anObject);
+		var native=eval(aString);
+		return new native(anObject);
 	>
 !
 
 constructor: aString value:anObject value: anObject2
 	<
-    	var native=eval(aString); 
-        return new native(anObject,anObject2);
+		var native=eval(aString);
+		return new native(anObject,anObject2);
 	>
 !
 
 constructor: aString value:anObject value: anObject2 value:anObject3
 	<
-    	var native=eval(aString); 
-        return new native(anObject,anObject2, anObject3);
+		var native=eval(aString);
+		return new native(anObject,anObject2, anObject3);
 	>
 ! !
 
@@ -503,11 +503,11 @@ constructor: aString value:anObject value: anObject2 value:anObject3
 
 exists: aString
 	<
-    	if(aString in window) {
-        	return true
-        } else {
-        	return false
-        }
-    >
+		if(aString in window) {
+			return true
+		} else {
+			return false
+		}
+	>
 ! !
 

+ 149 - 149
st/Kernel-Objects.st

@@ -5,7 +5,7 @@ nil subclass: #Object
 !Object commentStamp!
 *Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.
 
-Object provides default behavior common to all normal objects, such as: 
+Object provides default behavior common to all normal objects, such as:
 
 - access
 - copying
@@ -30,14 +30,14 @@ The hook method `#postCopy` can be overriden in subclasses to copy fields as nec
 
 ##Comparison
 
-Objects understand equality  `#=` and identity `#==` comparison.
+Objects understand equality	 `#=` and identity `#==` comparison.
 
 ##Error handling
 
 - `#halt` is the typical message to use for inserting breakpoints during debugging.
 - `#error:` throws a generic error exception
 - `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.
-  Overriding this message can be useful to implement proxies for example.!
+	Overriding this message can be useful to implement proxies for example.!
 
 !Object methodsFor: 'accessing'!
 
@@ -50,7 +50,7 @@ basicAt: aString put: anObject
 !
 
 basicDelete: aString
-    <delete self[aString]; return aString>
+	<delete self[aString]; return aString>
 !
 
 class
@@ -133,8 +133,8 @@ asString
 
 test
 	| a |
-    a := 1.
-    self halt
+	a := 1.
+	self halt
 ! !
 
 !Object methodsFor: 'copying'!
@@ -144,14 +144,14 @@ copy
 !
 
 deepCopy
-	<    
-	    var copy = self.klass._new();
-	    for(var i in self) {
+	<	
+		var copy = self.klass._new();
+		for(var i in self) {
 		if(/^@.+/.test(i)) {
-		    copy[i] = self[i]._deepCopy();
+			copy[i] = self[i]._deepCopy();
 		}
-	    }
-	    return copy;
+		}
+		return copy;
 	>
 !
 
@@ -160,13 +160,13 @@ postCopy
 
 shallowCopy
 	<
-	    var copy = self.klass._new();
-	    for(var i in self) {
+		var copy = self.klass._new();
+		for(var i in self) {
 		if(/^@.+/.test(i)) {
-		    copy[i] = self[i];
+			copy[i] = self[i];
+		}
 		}
-	    }
-	    return copy;
+		return copy;
 	>
 ! !
 
@@ -217,7 +217,7 @@ initialize
 
 !Object methodsFor: 'message handling'!
 
-basicPerform: aSymbol 
+basicPerform: aSymbol
 	^self basicPerform: aSymbol withArguments: #()
 !
 
@@ -238,7 +238,7 @@ perform: aSymbol withArguments: aCollection
 log: aString block: aBlock
 
 	| result |
-	console log:  aString,  ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.
+	console log: aString,	' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.
 	^result
 !
 
@@ -255,7 +255,7 @@ storeOn: aStream
 !
 
 storeString
-	"Answer a String representation of the receiver from which the receiver 
+	"Answer a String representation of the receiver from which the receiver
 	can be reconstructed."
 
 	^ String streamContents: [:s | self storeOn: s]
@@ -293,8 +293,8 @@ isClass
 
 isKindOf: aClass
 	^(self isMemberOf: aClass)
-	    ifTrue: [true]
-	    ifFalse: [self class inheritsFrom: aClass]
+		ifTrue: [true]
+		ifFalse: [self class inheritsFrom: aClass]
 !
 
 isMemberOf: aClass
@@ -352,11 +352,11 @@ Boolean instances are weither `true` or `false`.!
 
 = aBoolean
 	<
-    	if(!! aBoolean._isBoolean || !! aBoolean._isBoolean()) {
-        	return false;
-        }
-    	return Boolean(self == true) == aBoolean
-    >
+		if(!! aBoolean._isBoolean || !! aBoolean._isBoolean()) {
+			return false;
+		}
+		return Boolean(self == true) == aBoolean
+	>
 !
 
 == aBoolean
@@ -367,18 +367,18 @@ Boolean instances are weither `true` or `false`.!
 
 & aBoolean
 	<
-	    if(self == true) {
+		if(self == true) {
 		return aBoolean;
-	    } else {
+		} else {
 		return false;
-	    }
+		}
 	>
 !
 
 and: aBlock
 	^self = true
-	    ifTrue: aBlock
-	    ifFalse: [false]
+		ifTrue: aBlock
+		ifFalse: [false]
 !
 
 ifFalse: aBlock
@@ -399,11 +399,11 @@ ifTrue: aBlock
 ifTrue: aBlock ifFalse: anotherBlock
 	"inlined in the Compiler"
 	<
-	    if(self == true) {
+		if(self == true) {
 		return aBlock();
-	    } else {
+		} else {
 		return anotherBlock();
-	    }
+		}
 	>
 !
 
@@ -413,17 +413,17 @@ not
 
 or: aBlock
 	^self = true
-	    ifTrue: [true]
-	    ifFalse: aBlock
+		ifTrue: [true]
+		ifFalse: aBlock
 !
 
 | aBoolean
 	<
-	    if(self == true) {
+		if(self == true) {
 		return true;
-	    } else {
+		} else {
 		return aBoolean;
-	    }
+		}
 	>
 ! !
 
@@ -651,15 +651,15 @@ JSOjbectProxy makes intensive use of `#doesNotUnderstand:`.
 
 JSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.
 
-    window alert: 'hello world'.
-    window inspect.
-    (window jQuery: 'body') append: 'hello world'
+	window alert: 'hello world'.
+	window inspect.
+	(window jQuery: 'body') append: 'hello world'
 
-Smalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown. 
+Smalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.
 
 ## Message conversion rules
 
-- `someUser name` becomes  `someUser.name`
+- `someUser name` becomes `someUser.name`
 - `someUser name: 'John'` becomes `someUser name = "John"`
 - `console log: 'hello world'` becomes `console.log('hello world')`
 - `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`
@@ -675,8 +675,8 @@ at: aSymbol
 at: aSymbol ifAbsent: aBlock
 	"return the aSymbol property or evaluate aBlock if the property is not defined on the object"
 	<
-    	var obj = self['@jsObject'],
-        	symbol = aSymbol._asString();
+		var obj = self['@jsObject'],
+			symbol = aSymbol._asString();
 		return symbol in obj ? obj[symbol] : aBlock();
 	>
 !
@@ -695,7 +695,7 @@ jsObject: aJSObject
 
 value
 	"if attribute 'value' exists on the JS object return it,
-    otherwise return the result of Object>>value."
+	otherwise return the result of Object>>value."
 	^ self at: 'value' ifAbsent: [super value]
 ! !
 
@@ -703,34 +703,34 @@ value
 
 keysAndValuesDo: aBlock
 	<
-    	var o = self['@jsObject'];
-    	for(var i in o) {
+		var o = self['@jsObject'];
+		for(var i in o) {
 			aBlock(i, o[i]);
 		}
-    >
+	>
 ! !
 
 !JSObjectProxy methodsFor: 'proxy'!
 
 addObjectVariablesTo: aDictionary
 	<
-    	for(var i in self['@jsObject']) {
+		for(var i in self['@jsObject']) {
 			aDictionary._at_put_(i, self['@jsObject'][i]);
 		}
-    >
+	>
 !
 
 doesNotUnderstand: aMessage
-    
-   ^ (self canForwardMessage: aMessage) 
-    	ifTrue: [ self forwardMessage: aMessage ]
-        ifFalse: [ ^ super doesNotUnderstand: aMessage ]
+	
+	^ (self canForwardMessage: aMessage)
+		ifTrue: [ self forwardMessage: aMessage ]
+		ifFalse: [ ^ super doesNotUnderstand: aMessage ]
 !
 
 forwardMessage: aMessage
 	<
-    	return smalltalk.send(self._jsObject(), aMessage._selector()._asJavaScriptSelector(), aMessage._arguments());
-    >
+		return smalltalk.send(self._jsObject(), aMessage._selector()._asJavaScriptSelector(), aMessage._arguments());
+	>
 !
 
 inspectOn: anInspector
@@ -750,13 +750,13 @@ printString
 
 canForwardMessage: aMessage
 	<
-    	var jsSelector = aMessage._selector()._asJavaScriptSelector();
-    	if(jsSelector in self._jsObject()) {
-        	return true
-        } else {
-        	return false;
-        }
-    >
+		var jsSelector = aMessage._selector()._asJavaScriptSelector();
+		if(jsSelector in self._jsObject()) {
+			return true
+		} else {
+			return false;
+		}
+	>
 ! !
 
 !JSObjectProxy class methodsFor: 'instance creation'!
@@ -771,10 +771,10 @@ Object subclass: #Number
 	instanceVariableNames: ''
 	package: 'Kernel-Objects'!
 !Number commentStamp!
-Number holds the most general methods for dealing with numbers.  
+Number holds the most general methods for dealing with numbers. 
 Number is directly mapped to JavaScript Number.
 
-Most arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript. 
+Most arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.
 
 ##Enumerating
 A Number can be used to evaluate a Block a fixed number of times:
@@ -859,11 +859,11 @@ squared
 
 = aNumber
 	<
-    	if(!! aNumber._isNumber || !! aNumber._isNumber()) {
-        	return false;
-        }
-    	return Number(self) == aNumber
-    >
+		if(!! aNumber._isNumber || !! aNumber._isNumber()) {
+			return false;
+		}
+		return Number(self) == aNumber
+	>
 !
 
 > aNumber
@@ -903,7 +903,7 @@ asString
 !
 
 atRandom
-    ^(Random new next * self) truncated + 1
+	^(Random new next * self) truncated + 1
 !
 
 rounded
@@ -917,9 +917,9 @@ to: aNumber
 	count := 1.
 	array := Array new.
 	(last - first) timesRepeat: [
-	    array at: count put: first.
-	    count := count + 1.
-	    first := first + 1].
+		array at: count put: first.
+		count := count + 1.
+		first := first + 1].
 	^array
 !
 
@@ -931,24 +931,24 @@ to: stop by: step
 	step = 0 ifTrue: [self error: 'step must be non-zero'].
 	step < 0
 		ifTrue: [[ value >= stop ] whileTrue: [
-	    			array at: pos put: value.
-	    			pos := pos + 1.
-	    			value := value + step]]
+					array at: pos put: value.
+					pos := pos + 1.
+					value := value + step]]
 		ifFalse: [[ value <= stop ] whileTrue: [
-	    			array at: pos put: value.
-	  			pos := pos + 1.
-	    			value := value + step]].
+					array at: pos put: value.
+				pos := pos + 1.
+					value := value + step]].
 	^array
 !
 
 truncated
 	<
-    	if(self >>= 0) {
-        	return Math.floor(self);
-        } else {
-        	return Math.floor(self * (-1)) * (-1);
-        };
-    >
+		if(self >>= 0) {
+			return Math.floor(self);
+		} else {
+			return Math.floor(self * (-1)) * (-1);
+		};
+	>
 !
 
 | aNumber
@@ -971,8 +971,8 @@ timesRepeat: aBlock
 	| count |
 	count := 1.
 	[count > self] whileFalse: [
-	    aBlock value.
-	    count := count + 1]
+		aBlock value.
+		count := count + 1]
 !
 
 to: stop by: step do: aBlock
@@ -981,11 +981,11 @@ to: stop by: step do: aBlock
 	step = 0 ifTrue: [self error: 'step must be non-zero'].
 	step < 0
 		ifTrue: [[ value >= stop ] whileTrue: [
-	    			aBlock value: value.
-	    			value := value + step]]
+					aBlock value: value.
+					value := value + step]]
 		ifFalse: [[ value <= stop ] whileTrue: [
-	    			aBlock value: value.
-	    			value := value + step]]
+					aBlock value: value.
+					value := value + step]]
 !
 
 to: stop do: aBlock
@@ -993,7 +993,7 @@ to: stop do: aBlock
 	| nextValue |
 	nextValue := self.
 	[nextValue <= stop]
-		whileTrue: 
+		whileTrue:
 			[aBlock value: nextValue.
 			nextValue := nextValue + 1]
 ! !
@@ -1072,18 +1072,18 @@ addElement: aString
 	super addElement: aString.
 
 	SystemAnnouncer current announce: (ProtocolAdded new
-    	protocol: aString;
-        theClass: self theClass;
-        yourself)
+		protocol: aString;
+		theClass: self theClass;
+		yourself)
 !
 
 removeElement: aString
 	super removeElement: aString.
 
 	SystemAnnouncer current announce: (ProtocolRemoved new
-    	protocol: aString;
-        theClass: self theClass;
-        yourself)
+		protocol: aString;
+		theClass: self theClass;
+		yourself)
 !
 
 theClass
@@ -1256,15 +1256,15 @@ defaultCommitPathSt: aString
 !
 
 resetCommitPaths
-        defaultCommitPathJs := nil.
-        defaultCommitPathSt := nil.
+		defaultCommitPathJs := nil.
+		defaultCommitPathSt := nil.
 ! !
 
 !Package class methodsFor: 'initialization'!
 
 initialize
 	super initialize.
-    self commitPathsFromLoader
+	self commitPathsFromLoader
 ! !
 
 !Package class methodsFor: 'loading-storing'!
@@ -1274,10 +1274,10 @@ fetch: aPackageName
 !
 
 fetch: aPackageName prefix: aPrefix
-	jQuery 
-    	getScript: (aPrefix , aPackageName , '.js') 
-        onSuccess: [ 
-        	(Package named: aPackageName) setupClasses ]
+	jQuery
+		getScript: (aPrefix , aPackageName , '.js')
+		onSuccess: [
+			(Package named: aPackageName) setupClasses ]
 ! !
 
 !Package class methodsFor: 'sorting'!
@@ -1387,7 +1387,7 @@ printString
 
 !Point methodsFor: 'transforming'!
 
-translateBy: delta 
+translateBy: delta
 	"Answer a Point translated by delta (an instance of Point)."
 	^(delta x + x) @ (delta y + y)
 ! !
@@ -1438,14 +1438,14 @@ next
 !
 
 next: anInteger
-    ^(1 to: anInteger) collect: [:each | self next]
+	^(1 to: anInteger) collect: [:each | self next]
 ! !
 
 Object subclass: #Smalltalk
 	instanceVariableNames: ''
 	package: 'Kernel-Objects'!
 !Smalltalk commentStamp!
-Smalltalk has only one instance, accessed with `Smalltalk current`. 
+Smalltalk has only one instance, accessed with `Smalltalk current`.
 It represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.
 
 The `smalltalk` object holds all class and packages defined in the system.
@@ -1468,7 +1468,7 @@ __note:__ classes and packages are accessed using strings, not symbols
 
 ## Parsing
 
-The `#parse:` method is used to parse Smalltalk source code. 
+The `#parse:` method is used to parse Smalltalk source code.
 It requires the `Compiler` package and the `js/parser.js` parser file in order to work!
 
 !Smalltalk methodsFor: 'accessing'!
@@ -1478,7 +1478,7 @@ at: aSymbol
 !
 
 parse: aString
-	| result | 
+	| result |
 	self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].
 	^result
 !
@@ -1494,8 +1494,8 @@ reservedWords
 
 version
 	"Answer the version string of Amber"
-    
-    ^ '0.10'
+	
+	^ '0.10'
 ! !
 
 !Smalltalk methodsFor: 'classes'!
@@ -1506,30 +1506,30 @@ classes
 
 deleteClass: aClass
 	"Deletes a class by deleting its binding only. Use #removeClass instead"
-    
+	
 	<self.removeClass(aClass)>
 !
 
 removeClass: aClass
 	aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!!'].
-    
+	
 	self deleteClass: aClass.
-    
-    SystemAnnouncer current
-    	announce: (ClassRemoved new
-        	theClass: aClass;
-            yourself)
+	
+	SystemAnnouncer current
+		announce: (ClassRemoved new
+			theClass: aClass;
+			yourself)
 ! !
 
 !Smalltalk methodsFor: 'error handling'!
 
 asSmalltalkException: anObject
 	"A JavaScript exception may be thrown.
-    We then need to convert it back to a Smalltalk object"
-    
-    ^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])
-    	ifTrue: [ anObject ]
-      	ifFalse: [ JavaScriptException on: anObject ]
+	We then need to convert it back to a Smalltalk object"
+	
+	^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])
+		ifTrue: [ anObject ]
+		ifFalse: [ JavaScriptException on: anObject ]
 !
 
 parseError: anException parsing: aString
@@ -1540,22 +1540,22 @@ parseError: anException parsing: aString
 
 createPackage: packageName
 	"Create and bind a new package with given name and return it."
-       <return smalltalk.addPackage(packageName)>
+	<return smalltalk.addPackage(packageName)>
 !
 
 deletePackage: packageName
 	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
 	To remove a package, use #removePackage instead."
 
-       <delete smalltalk.packages[packageName]>
+	<delete smalltalk.packages[packageName]>
 !
 
 packageAt: packageName
-       <return self.packages[packageName]>
+	<return self.packages[packageName]>
 !
 
 packageAt: packageName ifAbsent: aBlock
-       ^(self packageAt: packageName) ifNil: aBlock
+	^(self packageAt: packageName) ifNil: aBlock
 !
 
 packages
@@ -1574,7 +1574,7 @@ removePackage: packageName
 	| pkg |
 	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
 	pkg classes do: [:each |
-        	self removeClass: each].
+			self removeClass: each].
 	self deletePackage: packageName
 !
 
@@ -1584,7 +1584,7 @@ renamePackage: packageName to: newName
 	| pkg |
 	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
 	(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].
-    (self basicAt: 'packages') at: newName put: pkg.
+	(self basicAt: 'packages') at: newName put: pkg.
 	pkg name: newName.
 	self deletePackage: packageName.
 ! !
@@ -1596,20 +1596,20 @@ basicParse: aString
 !
 
 createPackage: packageName properties: aDict
-    "Needed to import .st files: they begin with this call."
-    self deprecatedAPI.
-    
-    aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].
-    ^ self createPackage: packageName
+	"Needed to import .st files: they begin with this call."
+	self deprecatedAPI.
+	
+	aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].
+	^ self createPackage: packageName
 ! !
 
 !Smalltalk methodsFor: 'testing'!
 
 isSmalltalkObject: anObject
 	"Consider anObject a Smalltalk object if it has a 'klass' property.
-    Note that this may be unaccurate"
-    
-    <return typeof anObject.klass !!== 'undefined'>
+	Note that this may be unaccurate"
+	
+	<return typeof anObject.klass !!== 'undefined'>
 ! !
 
 Smalltalk class instanceVariableNames: 'current'!
@@ -1638,16 +1638,16 @@ rawTimeout: anObject
 
 clearInterval
 	<
-    	var interval = self["@rawTimeout"];
+		var interval = self["@rawTimeout"];
 		clearInterval(interval);
-    >
+	>
 !
 
 clearTimeout
 	<
-    	var timeout = self["@rawTimeout"];
+		var timeout = self["@rawTimeout"];
 		clearTimeout(timeout);
-    >
+	>
 ! !
 
 !Timeout class methodsFor: 'instance creation'!
@@ -1678,7 +1678,7 @@ subclass: aString instanceVariableNames: aString2 category: aString3
 
 subclass: aString instanceVariableNames: aString2 package: aString3
 	^ClassBuilder new
-	    superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
+		superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
 ! !
 
 !UndefinedObject methodsFor: 'converting'!
@@ -1700,7 +1700,7 @@ shallowCopy
 !UndefinedObject methodsFor: 'printing'!
 
 printString
-    ^'nil'
+	^'nil'
 ! !
 
 !UndefinedObject methodsFor: 'testing'!
@@ -1736,6 +1736,6 @@ notNil
 !UndefinedObject class methodsFor: 'instance creation'!
 
 new
-	    self error: 'You cannot create new instances of UndefinedObject. Use nil'
+		self error: 'You cannot create new instances of UndefinedObject. Use nil'
 ! !
 

+ 185 - 185
st/Kernel-Tests.st

@@ -19,11 +19,11 @@ testCompiledSource
 
 testCurrySelf
 	| curriedMethod array |
-    curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.
-    array := #(3 1 4).
-    ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.
-    [ self assert: (array foo: 2) equals: 1 ]
-    ensure: [ Array removeCompiledMethod: curriedMethod ]
+	curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.
+	array := #(3 1 4).
+	ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.
+	[ self assert: (array foo: 2) equals: 1 ]
+	ensure: [ Array removeCompiledMethod: curriedMethod ]
 !
 
 testEnsure
@@ -36,16 +36,16 @@ testEnsureRaises
 
 testExceptionSemantics
 	"See https://github.com/NicolasPetton/amber/issues/314"
-    self timeout: 100.
-    
-    (self async:  [ 
-    	[ 
-        	self assert: true. 
-            Error signal. 
-            "The following should *not* be run"
-            self deny: true.
-            self finished.
-  		] on: Error do: [ :ex | self finished ] 
+	self timeout: 100.
+	
+	(self async: [
+		[
+			self assert: true.
+			Error signal.
+			"The following should *not* be run"
+			self deny: true.
+			self finished.
+		] on: Error do: [ :ex | self finished ]
 	]) valueWithTimeout: 0
 !
 
@@ -61,7 +61,7 @@ testOnDo
 testValue
 	self assert: ([1+1] value) equals: 2.
 	self assert: ([:x | x +1] value: 2) equals: 3.
-	self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. 
+	self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8.
 
 	"Arguments are optional in Amber. This isn't ANSI compliant."
 
@@ -105,7 +105,7 @@ TestCase subclass: #BooleanTest
 testEquality
 	"We're on top of JS...just be sure to check the basics!!"
 
-	self deny: 0 = false. 
+	self deny: 0 = false.
 	self deny: false = 0.
 	self deny: '' = false.
 	self deny: false = ''.
@@ -123,7 +123,7 @@ testEquality
 testIdentity
 	"We're on top of JS...just be sure to check the basics!!"
 
-	self deny: 0 == false. 
+	self deny: 0 == false.
 	self deny: false == 0.
 	self deny: '' == false.
 	self deny: false == ''.
@@ -139,7 +139,7 @@ testIdentity
 !
 
 testIfTrueIfFalse
- 
+
 	self assert: (true ifTrue: ['alternative block']) equals: 'alternative block'.
 	self assert: (true ifFalse: ['alternative block']) equals: nil.
 
@@ -154,7 +154,7 @@ testIfTrueIfFalse
 !
 
 testIfTrueIfFalseWithBoxing
- 
+
 	self assert: (true yourself ifTrue: ['alternative block']) equals: 'alternative block'.
 	self assert: (true yourself ifFalse: ['alternative block']) equals: nil.
 
@@ -171,48 +171,48 @@ testIfTrueIfFalseWithBoxing
 testLogic
 	"Trivial logic table"
 	self assert: (true & true);
-    	deny: (true & false);
-        deny: (false & true);
-        deny: (false & false).
+		deny: (true & false);
+		deny: (false & true);
+		deny: (false & false).
 	self assert: (true | true);
-    	assert: (true | false);
-        assert: (false | true);
-        deny: (false | false).
+		assert: (true | false);
+		assert: (false | true);
+		deny: (false | false).
 	"Checking that expressions work fine too"
 	self assert: (true & (1 > 0));
-    	deny: ((1 > 0) & false);
-        deny: ((1 > 0) & (1 > 2)).
+		deny: ((1 > 0) & false);
+		deny: ((1 > 0) & (1 > 2)).
 	self assert: (false | (1 > 0));
-    	assert: ((1 > 0) | false);
-        assert: ((1 > 0) | (1 > 2))
+		assert: ((1 > 0) | false);
+		assert: ((1 > 0) | (1 > 2))
 !
 
 testLogicKeywords
 	"Trivial logic table"
-	self 
-		assert: (true and: [ true]); 
-		deny: (true and: [ false ]); 
-		deny: (false and: [ true ]); 
+	self
+		assert: (true and: [ true]);
+		deny: (true and: [ false ]);
+		deny: (false and: [ true ]);
 		deny: (false and: [ false ]).
-	self 
-		assert: (true or: [ true ]); 
-		assert: (true or: [ false ]); 
-		assert: (false or: [ true ]); 
+	self
+		assert: (true or: [ true ]);
+		assert: (true or: [ false ]);
+		assert: (false or: [ true ]);
 		deny: (false or: [ false ]).
-        
+		
 	"Checking that expressions work fine too"
-	self 
-		assert: (true and: [ 1 > 0 ]); 
-		deny: ((1 > 0) and: [ false ]); 
+	self
+		assert: (true and: [ 1 > 0 ]);
+		deny: ((1 > 0) and: [ false ]);
 		deny: ((1 > 0) and: [ 1 > 2 ]).
-	self 
-		assert: (false or: [ 1 > 0 ]); 
-		assert: ((1 > 0) or: [ false ]); 
+	self
+		assert: (false or: [ 1 > 0 ]);
+		assert: ((1 > 0) or: [ false ]);
 		assert: ((1 > 0) or: [ 1 > 2 ])
 !
 
 testNonBooleanError
-    self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver
+	self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver
 ! !
 
 TestCase subclass: #ClassBuilderTest
@@ -242,63 +242,63 @@ testClassCopy
 
 testClassMigration
 	| instance oldClass |
-    
-    oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.
-    instance := (Smalltalk  current at: 'ObjectMock2') new.
-    
-    "Change the superclass of ObjectMock2"
-    ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
-    	instanceVariableNames: ''
-        package: 'Kernel-Tests'.
-    
-    self deny: oldClass == ObjectMock2.
-    
+	
+	oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.
+	instance := (Smalltalk	current at: 'ObjectMock2') new.
+	
+	"Change the superclass of ObjectMock2"
+	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+		instanceVariableNames: ''
+		package: 'Kernel-Tests'.
+	
+	self deny: oldClass == ObjectMock2.
+	
 	self assert: ObjectMock2 superclass == ObjectMock.
 	self assert: ObjectMock2 instanceVariableNames isEmpty.
 	self assert: ObjectMock2 selectors equals: oldClass selectors.
-    self assert: ObjectMock2 comment equals: oldClass comment.
-    self assert: ObjectMock2 package name equals: 'Kernel-Tests'.
-    
+	self assert: ObjectMock2 comment equals: oldClass comment.
+	self assert: ObjectMock2 package name equals: 'Kernel-Tests'.
+	
 	self deny: instance class == ObjectMock2.
-    "Commeting this out. Tests implementation detail."
-    "self assert: instance class name equals: 'OldObjectMock2'."
-    
+	"Commeting this out. Tests implementation detail."
+	"self assert: instance class name equals: 'OldObjectMock2'."
+	
 	self assert: (Smalltalk current at: instance class name) isNil.
-    
-    Smalltalk current removeClass: ObjectMock2
+	
+	Smalltalk current removeClass: ObjectMock2
 !
 
 testClassMigrationWithClassInstanceVariables
-    
-    builder copyClass: ObjectMock named: 'ObjectMock2'.
-    ObjectMock2 class instanceVariableNames: 'foo bar'.
-    
-    "Change the superclass of ObjectMock2"
-    ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
-    	instanceVariableNames: ''
-        package: 'Kernel-Tests'.
-    
-    self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').
-    
-    Smalltalk current removeClass: ObjectMock2
+	
+	builder copyClass: ObjectMock named: 'ObjectMock2'.
+	ObjectMock2 class instanceVariableNames: 'foo bar'.
+	
+	"Change the superclass of ObjectMock2"
+	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+		instanceVariableNames: ''
+		package: 'Kernel-Tests'.
+	
+	self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').
+	
+	Smalltalk current removeClass: ObjectMock2
 !
 
 testClassMigrationWithSubclasses
-    
-    builder copyClass: ObjectMock named: 'ObjectMock2'.
-    ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.
-    ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.
-    
-    "Change the superclass of ObjectMock2"
-    ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
-    	instanceVariableNames: ''
-        package: 'Kernel-Tests'.
-    
-    self assert: (ObjectMock subclasses includes: ObjectMock2).
-    self assert: (ObjectMock2 subclasses includes: ObjectMock3).
-    self assert: (ObjectMock3 subclasses includes: ObjectMock4).
-    
-    ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]
+	
+	builder copyClass: ObjectMock named: 'ObjectMock2'.
+	ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.
+	ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.
+	
+	"Change the superclass of ObjectMock2"
+	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+		instanceVariableNames: ''
+		package: 'Kernel-Tests'.
+	
+	self assert: (ObjectMock subclasses includes: ObjectMock2).
+	self assert: (ObjectMock2 subclasses includes: ObjectMock3).
+	self assert: (ObjectMock3 subclasses includes: ObjectMock4).
+	
+	ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]
 !
 
 testInstanceVariableNames
@@ -344,14 +344,14 @@ isCollectionReadOnly
 !CollectionTest methodsFor: 'tests'!
 
 testAsArray
-	self 
-		assertSameContents: self collection 
+	self
+		assertSameContents: self collection
 		as: self collection asArray
 !
 
 testAsOrderedCollection
-	self 
-		assertSameContents: self collection 
+	self
+		assertSameContents: self collection
 		as: self collection asOrderedCollection
 !
 
@@ -366,8 +366,8 @@ testAsSet
 
 testCollect
 	| newCollection |
-	newCollection :=  #(1 2 3 4).
-	self 
+	newCollection := #(1 2 3 4).
+	self
 		assertSameContents: (self collection collect: [ :each |
 			each abs ])
 		as: newCollection
@@ -375,7 +375,7 @@ testCollect
 
 testDetect
 	self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.
-	self 
+	self
 		should: [ self collection detect: [ :each | each = 6 ] ]
 		raise: Error
 !
@@ -385,8 +385,8 @@ testDo
 	newCollection := OrderedCollection new.
 	self collection do: [ :each |
 		newCollection add: each ].
-	self 
-		assertSameContents: self collection 
+	self
+		assertSameContents: self collection
 		as: newCollection
 !
 
@@ -398,7 +398,7 @@ testIsEmpty
 testSelect
 	| newCollection |
 	newCollection := #(2 -4).
-	self 
+	self
 		assertSameContents: (self collection select: [ :each |
 			each even ])
 		as: newCollection
@@ -578,59 +578,59 @@ testPointKey
 	| d |
 
 	d := Dictionary new.
-    
-    d at: 1@1 put: 'foo'.
+	
+	d at: 1@1 put: 'foo'.
 	self assert: (d at: 1@1) equals: 'foo'.
-    d at: 1@1 put: 'bar'.
+	d at: 1@1 put: 'bar'.
 	self assert: (d at: 1@1) equals: 'bar'.
-    d removeKey: 1@1.
-    self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.
-    self deny: (d includesKey: 1@1)
+	d removeKey: 1@1.
+	self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.
+	self deny: (d includesKey: 1@1)
 !
 
 testPrintString
 	self
-		assert: (Dictionary new 
-                         	at:'firstname' put: 'James';
-                        	at:'lastname' put: 'Bond';
-                        	printString)
+		assert: (Dictionary new
+							at:'firstname' put: 'James';
+							at:'lastname' put: 'Bond';
+							printString)
 		equals: 'a Dictionary(''firstname''->''James'' , ''lastname''->''Bond'')'
 !
 
 testRemoveKey
-    | d key |
+	| d key |
 
-    d := Dictionary new.
-    d at: 1 put: 2.
-    d at: 2 put: 3.
-    d at: 3 put: 4.
+	d := Dictionary new.
+	d at: 1 put: 2.
+	d at: 2 put: 3.
+	d at: 3 put: 4.
 
-    key := 2.
+	key := 2.
 
-    self assert: d keys equals: #(1 2 3).
+	self assert: d keys equals: #(1 2 3).
 
-    d removeKey: key.
-    self assert: d keys equals: #(1 3).
-    self assert: d values equals: #(2 4).
-    self deny: (d includesKey: 2)
+	d removeKey: key.
+	self assert: d keys equals: #(1 3).
+	self assert: d values equals: #(2 4).
+	self deny: (d includesKey: 2)
 !
 
 testRemoveKeyIfAbsent
-    | d key |
+	| d key |
 
-    d := Dictionary new.
-    d at: 1 put: 2.
-    d at: 2 put: 3.
-    d at: 3 put: 4.
+	d := Dictionary new.
+	d at: 1 put: 2.
+	d at: 2 put: 3.
+	d at: 3 put: 4.
 
-    key := 2.
-    self assert: (d removeKey: key) equals: 3.
+	key := 2.
+	self assert: (d removeKey: key) equals: 3.
 
-    key := 3.
-    self assert: (d removeKey: key ifAbsent: [42]) equals: 4.
+	key := 3.
+	self assert: (d removeKey: key ifAbsent: [42]) equals: 4.
 
-    key := 'why'.
-    self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.
+	key := 'why'.
+	self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.
 !
 
 testSize
@@ -764,21 +764,21 @@ testAtPut
 testCollect
 	| newCollection |
 	newCollection := 'hheelllloo'.
-	self 
+	self
 		assertSameContents: (self collection collect: [ :each |
 			each, each ])
 		as: newCollection
 !
 
 testCopyWithoutAll
-	self 
+	self
 		assert: ('*hello* *world*' copyWithoutAll: '*')
-        equals: 'hello world'
+		equals: 'hello world'
 !
 
 testDetect
 	self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.
-	self 
+	self
 		should: [ self collection detect: [ :each | each = 6 ] ]
 		raise: Error
 !
@@ -787,7 +787,7 @@ testEquality
 	self assert: 'hello' equals: 'hello'.
 	self deny: 'hello' = 'world'.
 
-	self assert: 'hello'  equals: 'hello' yourself.
+	self assert: 'hello' equals: 'hello' yourself.
 	self assert: 'hello' yourself equals: 'hello'.
 
 	"test JS falsy value"
@@ -817,7 +817,7 @@ testJoin
 testSelect
 	| newCollection |
 	newCollection := 'o'.
-	self 
+	self
 		assertSameContents: (self collection select: [ :each |
 			each = 'o' ])
 		as: newCollection
@@ -829,10 +829,10 @@ testSize
 !
 
 testStreamContents
-	self 
-		assert: (String streamContents: [ :aStream | 
-			aStream 
-				nextPutAll: 'hello'; space; 
+	self
+		assert: (String streamContents: [ :aStream |
+			aStream
+				nextPutAll: 'hello'; space;
 				nextPutAll: 'world' ])
 		equals: 'hello world'
 ! !
@@ -881,7 +881,7 @@ testAtPut
 testCollect
 	| newCollection |
 	newCollection := #hheelllloo.
-	self 
+	self
 		assertSameContents: (self collection collect: [ :each |
 			each, each ])
 		as: newCollection
@@ -908,7 +908,7 @@ testCopying
 
 testDetect
 	self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.
-	self 
+	self
 		should: [ self collection detect: [ :each | each = 'z' ] ]
 		raise: Error
 !
@@ -928,7 +928,7 @@ testIdentity
 	self assert: #hello == #hello.
 	self deny: #hello == #world.
 
-	self assert: #hello  = #hello yourself.
+	self assert: #hello	 = #hello yourself.
 	self assert: #hello yourself = #hello asString asSymbol
 !
 
@@ -947,7 +947,7 @@ testIsSymbolIsString
 testSelect
 	| newCollection |
 	newCollection := 'o'.
-	self 
+	self
 		assertSameContents: (self collection select: [ :each |
 			each = 'o' ])
 		as: newCollection
@@ -978,11 +978,11 @@ jsObject
 
 testAtIfAbsent
 	| testObject |
-    testObject := self jsObject.
+	testObject := self jsObject.
 	self assert: (testObject at: 'abc' ifAbsent: ['Property does not exist']) equals: 'Property does not exist'.
 	self assert: (testObject at: 'e' ifAbsent: ['Property does not exist']) equals: nil.
-    self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.
-    self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.
+	self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.
+	self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.
 !
 
 testDNU
@@ -1018,15 +1018,15 @@ testPropertyThatReturnsUndefined
 	| object |
 
 	object := self jsObject.
-	self shouldnt: [ object e ]  raise: MessageNotUnderstood.
-    self assert: object e isNil
+	self shouldnt: [ object e ]	 raise: MessageNotUnderstood.
+	self assert: object e isNil
 !
 
 testValue
 	| testObject |
-    testObject := self jsObject.
+	testObject := self jsObject.
 	self assert: testObject value printString equals: '[object Object]'.
-    testObject at: 'value' put: 'aValue'.
+	testObject at: 'value' put: 'aValue'.
 	self assert: testObject value equals: 'aValue'
 !
 
@@ -1053,8 +1053,8 @@ throwException
 
 testCatchingException
 	[ self throwException ]
-  		on: Error
-        do: [ :error | 
+		on: Error
+		do: [ :error |
 			self assert: error exception = 'test' ]
 !
 
@@ -1075,7 +1075,7 @@ testAbs
 
 testArithmetic
 	
-	"We rely on JS here, so we won't test complex behavior, just check if 
+	"We rely on JS here, so we won't test complex behavior, just check if
 	message sends are corrects"
 
 	self assert: 1.5 + 1 equals: 2.5.
@@ -1149,46 +1149,46 @@ testIdentity
 testInvalidHexNumbers
 
 	self should: [16rG] raise: MessageNotUnderstood.
-   	self should: [16rg] raise: MessageNotUnderstood.
+	self should: [16rg] raise: MessageNotUnderstood.
 	self should: [16rH] raise: MessageNotUnderstood.
-   	self should: [16rh] raise: MessageNotUnderstood.
+	self should: [16rh] raise: MessageNotUnderstood.
 	self should: [16rI] raise: MessageNotUnderstood.
-   	self should: [16ri] raise: MessageNotUnderstood.
+	self should: [16ri] raise: MessageNotUnderstood.
 	self should: [16rJ] raise: MessageNotUnderstood.
-   	self should: [16rj] raise: MessageNotUnderstood.
+	self should: [16rj] raise: MessageNotUnderstood.
 	self should: [16rK] raise: MessageNotUnderstood.
-   	self should: [16rk] raise: MessageNotUnderstood.
+	self should: [16rk] raise: MessageNotUnderstood.
 	self should: [16rL] raise: MessageNotUnderstood.
-   	self should: [16rl] raise: MessageNotUnderstood.
+	self should: [16rl] raise: MessageNotUnderstood.
 	self should: [16rM] raise: MessageNotUnderstood.
-   	self should: [16rm] raise: MessageNotUnderstood.
+	self should: [16rm] raise: MessageNotUnderstood.
 	self should: [16rN] raise: MessageNotUnderstood.
-   	self should: [16rn] raise: MessageNotUnderstood.
+	self should: [16rn] raise: MessageNotUnderstood.
 	self should: [16rO] raise: MessageNotUnderstood.
-   	self should: [16ro] raise: MessageNotUnderstood.
+	self should: [16ro] raise: MessageNotUnderstood.
 	self should: [16rP] raise: MessageNotUnderstood.
-   	self should: [16rp] raise: MessageNotUnderstood.
+	self should: [16rp] raise: MessageNotUnderstood.
 	self should: [16rQ] raise: MessageNotUnderstood.
-   	self should: [16rq] raise: MessageNotUnderstood.
+	self should: [16rq] raise: MessageNotUnderstood.
 	self should: [16rR] raise: MessageNotUnderstood.
-   	self should: [16rr] raise: MessageNotUnderstood.
+	self should: [16rr] raise: MessageNotUnderstood.
 	self should: [16rS] raise: MessageNotUnderstood.
-   	self should: [16rs] raise: MessageNotUnderstood.
+	self should: [16rs] raise: MessageNotUnderstood.
 	self should: [16rT] raise: MessageNotUnderstood.
-   	self should: [16rt] raise: MessageNotUnderstood.
+	self should: [16rt] raise: MessageNotUnderstood.
 	self should: [16rU] raise: MessageNotUnderstood.
-   	self should: [16ru] raise: MessageNotUnderstood.
+	self should: [16ru] raise: MessageNotUnderstood.
 	self should: [16rV] raise: MessageNotUnderstood.
-   	self should: [16rv] raise: MessageNotUnderstood.
+	self should: [16rv] raise: MessageNotUnderstood.
 	self should: [16rW] raise: MessageNotUnderstood.
-   	self should: [16rw] raise: MessageNotUnderstood.
+	self should: [16rw] raise: MessageNotUnderstood.
 	self should: [16rX] raise: MessageNotUnderstood.
-   	self should: [16rx] raise: MessageNotUnderstood.
+	self should: [16rx] raise: MessageNotUnderstood.
 	self should: [16rY] raise: MessageNotUnderstood.
-   	self should: [16ry] raise: MessageNotUnderstood.
+	self should: [16ry] raise: MessageNotUnderstood.
 	self should: [16rZ] raise: MessageNotUnderstood.
-   	self should: [16rz] raise: MessageNotUnderstood.
-    self should: [16rABcdEfZ] raise: MessageNotUnderstood.
+	self should: [16rz] raise: MessageNotUnderstood.
+	self should: [16rABcdEfZ] raise: MessageNotUnderstood.
 !
 
 testMinMax
@@ -1388,7 +1388,7 @@ setUp
 	Package resetCommitPaths.
 
 	zorkPackage := Package new name: 'Zork'.
-	grulPackage := Package new 
+	grulPackage := Package new
 					name: 'Grul';
 					commitPathJs: 'server/grul/js';
 					commitPathSt: 'grul/st';
@@ -1396,7 +1396,7 @@ setUp
 !
 
 tearDown
-	 Package 
+	 Package
 		defaultCommitPathJs: backUpCommitPathJs;
 		defaultCommitPathSt: backUpCommitPathSt
 ! !
@@ -1502,7 +1502,7 @@ TestCase subclass: #RandomTest
 textNext
 
 	10000 timesRepeat: [
-			| current next | 
+			| current next |
 			next := Random new next.
 			self assert: (next >= 0).
 			self assert: (next < 1).
@@ -1542,9 +1542,9 @@ testCollect
 
 testComparing
 	self assert: #(0 2) asSet equals: #(0 2) asSet.
-    self assert: #(2 0) asSet equals: #(0 2) asSet.
-    self deny: #(0 2 3) asSet = #(0 2) asSet.
-    self deny: #(1 2) asSet = #(0 2) asSet
+	self assert: #(2 0) asSet equals: #(0 2) asSet.
+	self deny: #(0 2 3) asSet = #(0 2) asSet.
+	self deny: #(1 2) asSet = #(0 2) asSet
 !
 
 testPrintString

+ 6 - 6
st/Kernel-Transcript.st

@@ -37,15 +37,15 @@ Transcript class instanceVariableNames: 'current'!
 !Transcript class methodsFor: 'instance creation'!
 
 current
-    ^current
+	^current
 !
 
 new
-    self shouldNotImplement
+	self shouldNotImplement
 !
 
 open
-    self current open
+	self current open
 !
 
 register: aTranscript
@@ -55,14 +55,14 @@ register: aTranscript
 !Transcript class methodsFor: 'printing'!
 
 clear
-    self current clear
+	self current clear
 !
 
 cr
-    self current show: String cr
+	self current show: String cr
 !
 
 show: anObject
-    self current show: anObject
+	self current show: anObject
 ! !
 

+ 40 - 40
st/SUnit-Tests.st

@@ -27,11 +27,11 @@ testGrow
 !
 
 testIllegal
-	self 
-		should: [empty at: 5] 
+	self
+		should: [empty at: 5]
 		raise: Error.
-	self 
-		should: [empty at: 5 put: #abc] 
+	self
+		should: [empty at: 5 put: #abc]
 		raise: Error
 !
 
@@ -62,40 +62,40 @@ TestCase subclass: #SUnitAsyncTest
 fakeError
 	flag := 'bad'.
 	self timeout: 10.
-    flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 5
+	flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 5
 !
 
 fakeErrorFailingInTearDown
 	flag := 'bad'.
 	self timeout: 10.
-    flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 5
+	flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 5
 !
 
 fakeFailure
 	flag := 'bad'.
 	self timeout: 10.
-    flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 5
+	flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 5
 !
 
 fakeMultipleTimeoutFailing
 	self timeout: 100.
-    (self async: [
+	(self async: [
 		self timeout: 5.
-        (self async: [ self finished ]) valueWithTimeout: 10
+		(self async: [ self finished ]) valueWithTimeout: 10
 	]) valueWithTimeout: 5
 !
 
 fakeMultipleTimeoutPassing
 	self timeout: 10.
-    (self async: [
+	(self async: [
 		self timeout: 20.
-        (self async: [ self finished ]) valueWithTimeout: 10
+		(self async: [ self finished ]) valueWithTimeout: 10
 	]) valueWithTimeout: 5
 !
 
 fakeTimeout
 	self timeout: 4.
-    (self async: [ self finished ]) valueWithTimeout: 5
+	(self async: [ self finished ]) valueWithTimeout: 5
 ! !
 
 !SUnitAsyncTest methodsFor: 'private'!
@@ -119,59 +119,59 @@ tearDown
 testAsyncErrorsAndFailures
 	| suite runner result assertBlock |
 	suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].
-    runner := TestSuiteRunner on: suite.
-    self timeout: 200.
+	runner := TestSuiteRunner on: suite.
+	self timeout: 200.
 	result := runner result.
-    assertBlock := self async: [
+	assertBlock := self async: [
 		self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.
 		self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.
 		self finished
-  	].
-    runner announcer on: ResultAnnouncement do: [:ann |
-    	ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].
+	].
+	runner announcer on: ResultAnnouncement do: [:ann |
+		ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ]].
 	runner run
 !
 
 testAsyncNeedsTimeout
-    self should: [ self async: [ ] ] raise: Error.
-    self timeout: 0.
-    self shouldnt: [ self async: [ ] ] raise: Error.
-    self finished
+	self should: [ self async: [ ] ] raise: Error.
+	self timeout: 0.
+	self shouldnt: [ self async: [ ] ] raise: Error.
+	self finished
 !
 
 testFinishedNeedsTimeout
-    self should: [ self finished ] raise: Error.
-    self timeout: 0.
-    self shouldnt: [ self finished ] raise: Error.
+	self should: [ self finished ] raise: Error.
+	self timeout: 0.
+	self shouldnt: [ self finished ] raise: Error.
 !
 
 testIsAsyncReturnsCorrectValues
-    self deny: self isAsync.
-    self timeout: 0.
-    self assert: self isAsync.
-    self finished.
-    self deny: self isAsync
+	self deny: self isAsync.
+	self timeout: 0.
+	self assert: self isAsync.
+	self finished.
+	self deny: self isAsync
 !
 
 testPass
 	flag := 'bad'.
 	self timeout: 10.
-    flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5
+	flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5
 !
 
 testTimeouts
 	| suite runner result assertBlock |
 	suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].
-    runner := TestSuiteRunner on: suite.
-    self timeout: 200.
+	runner := TestSuiteRunner on: suite.
+	self timeout: 200.
 	result := runner result.
-    assertBlock := self async: [
+	assertBlock := self async: [
 		self assert: (self selectorSetOf: result errors) equals: Set new.
 		self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.
 		self finished
-  	].
-    runner announcer on: ResultAnnouncement do: [:ann |
-    	ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].
+	].
+	runner announcer on: ResultAnnouncement do: [:ann |
+		ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ]].
 	runner run
 !
 
@@ -179,8 +179,8 @@ testTwoAsyncPassesWithFinishedOnlyOneIsRun
 	| x |
 	flag := 'bad'.
 	self timeout: 10.
-    x := 0.
-    flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.
-    flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.
+	x := 0.
+	flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.
+	flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.
 ! !
 

+ 63 - 63
st/SUnit.st

@@ -17,14 +17,14 @@ Object subclass: #TestCase
 	instanceVariableNames: 'testSelector asyncTimeout context'
 	package: 'SUnit'!
 !TestCase commentStamp!
-A TestCase is an implementation of the command pattern to run a test.  
+A TestCase is an implementation of the command pattern to run a test.
 
-`TestCase` instances are created with the class method `#selector:`, 
+`TestCase` instances are created with the class method `#selector:`,
 passing the symbol that names the method to be executed when the test case runs.
 
-When you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.  
-As that method develops and more `#test...` methods are added, you will find yourself refactoring temps 
-into instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.  
+When you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test. 
+As that method develops and more `#test...` methods are added, you will find yourself refactoring temps
+into instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.
 As required, override `#tearDown` to nil references, release objects and deallocate.!
 
 !TestCase methodsFor: 'accessing'!
@@ -46,8 +46,8 @@ setTestSelector: aSelector
 async: aBlock
 	| c |
 	self errorIfNotAsync: '#async'.
-    c := context.
-    ^ [ self isAsync ifTrue: [ c execute: aBlock ] ]
+	c := context.
+	^ [ self isAsync ifTrue: [ c execute: aBlock ] ]
 !
 
 finished
@@ -57,22 +57,22 @@ finished
 
 timeout: aNumber
 	"Set a grace time timeout in milliseconds to run the test asynchronously"
-    
+	
 	asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].
-    
-     "to allow #async: message send without throwing an error"
+	
+	 "to allow #async: message send without throwing an error"
 	asyncTimeout := 0.
-    
-	asyncTimeout := (self async: [ 
-    	self assert: false description: 'SUnit grace time exhausted' ])
-        	valueWithTimeout: aNumber
+	
+	asyncTimeout := (self async: [
+		self assert: false description: 'SUnit grace time exhausted' ])
+			valueWithTimeout: aNumber
 ! !
 
 !TestCase methodsFor: 'error handling'!
 
 errorIfNotAsync: aString
-	self isAsync ifFalse: [ 
-    	self error: aString, ' used without prior #timeout:' ]
+	self isAsync ifFalse: [
+		self error: aString, ' used without prior #timeout:' ]
 ! !
 
 !TestCase methodsFor: 'private'!
@@ -129,14 +129,14 @@ should: aBlock
 !
 
 should: aBlock raise: anExceptionClass
-	self assert: ([aBlock value. false] 
-		on: anExceptionClass 
+	self assert: ([aBlock value. false]
+		on: anExceptionClass
 		do: [:ex | true])
 !
 
 shouldnt: aBlock raise: anExceptionClass
-	self assert: ([aBlock value. true] 
-		on: anExceptionClass 
+	self assert: ([aBlock value. true]
+		on: anExceptionClass
 		do: [:ex | false])
 ! !
 
@@ -198,34 +198,34 @@ testCase: aTestCase
 
 execute: aBlock
 	| failed |
-    
-    testCase context: self.
-    [ 
-    	failed := true. 
-        aBlock value. 
-        failed := false 
-	] 
-    	ensure: [
-        	testCase context: nil.
-            
-        	(failed and: [ testCase isAsync ]) ifTrue: [ 
-            	testCase finished ].
-        	testCase isAsync ifFalse: [ 
-        		testCase tearDown ] ]
+	
+	testCase context: self.
+	[
+		failed := true.
+		aBlock value.
+		failed := false
+	]
+		ensure: [
+			testCase context: nil.
+			
+			(failed and: [ testCase isAsync ]) ifTrue: [
+				testCase finished ].
+			testCase isAsync ifFalse: [
+				testCase tearDown ] ]
 !
 
 start
-	self execute: [ 
-    	testCase setUp. 
-        testCase performTest ]
+	self execute: [
+		testCase setUp.
+		testCase performTest ]
 ! !
 
 !TestContext class methodsFor: 'instance creation'!
 
 testCase: aTestCase
 	^self new
-        testCase: aTestCase;
-        yourself
+		testCase: aTestCase;
+		yourself
 ! !
 
 TestContext subclass: #ReportingTestContext
@@ -252,41 +252,41 @@ result: aTestResult
 !ReportingTestContext methodsFor: 'private'!
 
 withErrorReporting: aBlock
- 	[ aBlock
-		on: TestFailure 
-		do: [ :ex | result addFailure: testCase ] 
+	[ aBlock
+		on: TestFailure
+		do: [ :ex | result addFailure: testCase ]
 	]
-    	on: Error 
-        do: [ :ex | result addError: testCase ]
+		on: Error
+		do: [ :ex | result addError: testCase ]
 ! !
 
 !ReportingTestContext methodsFor: 'running'!
 
 execute: aBlock
-    [ 
-    	self withErrorReporting: [ super execute: aBlock ] 
+	[
+		self withErrorReporting: [ super execute: aBlock ]
 	]
-    	ensure: [ 
-        	testCase isAsync ifFalse: [ 
-            	result increaseRuns. finished value ] ]
+		ensure: [
+			testCase isAsync ifFalse: [
+				result increaseRuns. finished value ] ]
 ! !
 
 !ReportingTestContext class methodsFor: 'instance creation'!
 
 testCase: aTestCase result: aTestResult finished: aBlock
 	^(super testCase: aTestCase)
-        result: aTestResult;
-        finished: aBlock;
-        yourself
+		result: aTestResult;
+		finished: aBlock;
+		yourself
 ! !
 
 Error subclass: #TestFailure
 	instanceVariableNames: ''
 	package: 'SUnit'!
 !TestFailure commentStamp!
-The test framework distinguishes between failures and errors.  
-A failure is an event whose possibiity is explicitly anticipated and checked for in an assertion, 
-whereas an error is an unanticipated problem like a division by 0 or an index out of bounds.  
+The test framework distinguishes between failures and errors.
+A failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,
+whereas an error is an unanticipated problem like a division by 0 or an index out of bounds.
 
 TestFailure is raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.!
 
@@ -294,7 +294,7 @@ Object subclass: #TestResult
 	instanceVariableNames: 'timestamp runs errors failures total'
 	package: 'SUnit'!
 !TestResult commentStamp!
-A TestResult implements the collecting parameter pattern for running a bunch of tests.  
+A TestResult implements the collecting parameter pattern for running a bunch of tests.	
 
 A TestResult holds tests that have run, sorted into the result categories of passed, failures and errors.
 
@@ -327,9 +327,9 @@ runs
 !
 
 status
-	^self errors isEmpty 
+	^self errors isEmpty
 		ifTrue: [
-			self failures isEmpty 
+			self failures isEmpty
 				ifTrue: ['success']
 				ifFalse: ['failure']]
 		ifFalse: ['error']
@@ -369,7 +369,7 @@ or does nothing if no more runs"
 
 runCase: aTestCase
 	[[	self increaseRuns.
-    	aTestCase runCase]
+		aTestCase runCase]
 	on: TestFailure do: [:ex | self addFailure: aTestCase]]
 	on: Error do: [:ex | self addError: aTestCase]
 ! !
@@ -396,7 +396,7 @@ suite: aCollection
 
 resume
 	runNextTest fork.
-    announcer announce: (ResultAnnouncement new result: result)
+	announcer announce: (ResultAnnouncement new result: result)
 !
 
 run
@@ -409,14 +409,14 @@ run
 initialize
 	super initialize.
 	announcer := Announcer new.
-    result := TestResult new.
-    runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ]].
+	result := TestResult new.
+	runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ]].
 ! !
 
 !TestSuiteRunner methodsFor: 'private'!
 
 contextOf: anInteger
-   	^ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]
+	^ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]
 ! !
 
 !TestSuiteRunner class methodsFor: 'instance creation'!

+ 8 - 8
st/Spaces.st

@@ -10,13 +10,13 @@ The implementation creates an iframe on the same location as the window, and con
 
 ## Usage example:
 
-    | space |
-    
-    space := ObjectSpace new.
-    space do: [ smalltalk ] "Answers aSmalltalk"
-    (space do: [ smalltalk ]) == smalltalk "Answers false"
-    
-    space release "Remove the object space environment"!
+	| space |
+	
+	space := ObjectSpace new.
+	space do: [ smalltalk ] "Answers aSmalltalk"
+	(space do: [ smalltalk ]) == smalltalk "Answers false"
+	
+	space release "Remove the object space environment"!
 
 !ObjectSpace methodsFor: 'accessing'!
 
@@ -34,7 +34,7 @@ do: aBlock
 !ObjectSpace methodsFor: 'events'!
 
 whenReadyDo: aBlock
-	(window jQuery: frame) 
+	(window jQuery: frame)
 		bind: 'load'
 		do: aBlock
 ! !

Some files were not shown because too many files changed in this diff