summaryrefslogtreecommitdiff
blob: a6724a9093ac34f91708dbcf71e78a17905b35f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
commit 38772fa56ed7edef88e71df8a69eea4f341968ed
Author: Giselle Reis <giselle.mnr@gmail.com>
Date:   Fri Jul 26 15:28:03 2019 +0300

    Removing deprecated function String.set
    
    Teyjus will not build with a typecheck error
    because String.set takes bytes, not a string. This
    commit fixes this issue.
    String.set is deprecated, so Bytes.set is used
    instead.

diff --git a/source/compiler/bytecode.ml b/source/compiler/bytecode.ml
index 957c276..655ddab 100644
--- a/source/compiler/bytecode.ml
+++ b/source/compiler/bytecode.ml
@@ -248,28 +248,28 @@ let readWord () = readNBytes (getInChannel ()) (getWordSize ())
 let readString () =
   let input = getInChannel () in
   let length = readNBytes input 4 in
-  let myString = String.make length ' ' in
+  let myString = Bytes.make length ' ' in
   let rec readStringAux index =
 	if (index = length) then ()
 	else 
-	  (String.set myString index (input_char input);
+	  (Bytes.set myString index (input_char input);
 	   readStringAux (index + 1))
   in
   readStringAux 0;
-  myString 
+  Bytes.to_string myString 
 
 let readLongString () = 
   let input = getInChannel() in
   let length = readNBytes input 4 in
-  let myString = String.make length ' ' in
+  let myString = Bytes.make length ' ' in
   let rec readStringAux index =
 	if (index = length) then ()
 	else 
-	  (String.set myString index (input_char input);
+	  (Bytes.set myString index (input_char input);
 	   readStringAux (index + 1))
   in
   readStringAux 0;
-  myString 
+  Bytes.to_string myString 
 
 (* skip n bytes   *)
 let skipNBytes numberBytes =