Fix in PPCMethod>>addVariable: make sure variable is added only once.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 30 Oct 2014 23:03:03 +0000
changeset 399 b5b7a6db033b
parent 398 b3e47bab2de6
child 400 49dc52d760c8
Fix in PPCMethod>>addVariable: make sure variable is added only once. Having two variables with the same name is forbidden.
compiler/PPCMethod.st
--- a/compiler/PPCMethod.st	Thu Oct 30 23:01:54 2014 +0000
+++ b/compiler/PPCMethod.st	Thu Oct 30 23:03:03 2014 +0000
@@ -7,6 +7,7 @@
 	category:'PetitCompiler-Core'
 !
 
+
 !PPCMethod class methodsFor:'instance creation'!
 
 new
@@ -28,7 +29,9 @@
 !
 
 addVariable: name
-	variables add: name.
+    (variables includes: name) ifFalse:[ variables add: name ].
+
+    "Modified: / 30-10-2014 / 23:00:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 allowInline
@@ -108,9 +111,18 @@
 !PPCMethod methodsFor:'initialization'!
 
 initialize
-	buffer := WriteStream on: ''.
-	indentation := 1.
-	variables := OrderedCollection new.
-	canInline := false
+        buffer := WriteStream on: ''.
+        indentation := 1.
+        variables := OrderedCollection new.
+        canInline := false
+
+    "Modified: / 30-10-2014 / 22:59:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!PPCMethod class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+