compiler/TCompilerExamples.st
changeset 11 6d39860d0fdb
parent 10 2b9beeac547e
child 13 97090c2baa33
--- a/compiler/TCompilerExamples.st	Mon Sep 14 16:27:00 2015 +0100
+++ b/compiler/TCompilerExamples.st	Wed Sep 16 05:29:43 2015 +0100
@@ -22,29 +22,14 @@
 example_if
     | environment unit compiler|
 
-    environment := TNamespaceDefinition new.
+    environment := TEnvironment new.
     unit := TSourceReader read:'
-nil subclass: #tBoolean
-    category: ''tKernel-Builtins''
-!! 
-
-nil subclass: #tSIntegerW
-    category: ''tKernel-Builtins''
+nil subclass: #If
+    category: ''t-Examples''
 !!
-!!tSIntegerW methodsFor:''testing''!!
-= another <tSIntegerW> <^ tBoolean> 
-    %[:asm | 
-        asm ret: (asm add: self _: another)
-    %].
-    "Following code is actually used only in hosted environment"
-    ^ self + another
-!! !!
-
-!!tSIntegerW class methodsFor:''test''!!
-threePlusFour <^ tSIntegerW> 
-        ^ 3 + 4
-
-!! !!
+!!If class methodsFor:''examples''!!
+if <^ tSIntegerW> 
+        true ifTrue:[ ^ 1 ] ifFalse:[ ^ 0 ]
     '.
 
     compiler := TCompiler new.
@@ -55,7 +40,7 @@
     "
 
     "Created: / 14-09-2015 / 12:14:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 14-09-2015 / 14:27:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-09-2015 / 12:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 example_three_plus_four