Permalink
Browse files

Added/completed symbol and keyword objs.

  • Loading branch information...
1 parent 561beca commit 5a7570ac0e0a191c07c514805ff12ccf4bddf884 @Gabriano Gabriano committed Aug 10, 2012
Showing with 25 additions and 1 deletion.
  1. +24 −0 gsc/_t-univ.scm
  2. +1 −1 include/stamp.h
View
@@ -851,6 +851,9 @@
((undefined? obj)
(univ-undefined ctx))
+
+ ((symbol? obj)
+ (univ-symbol ctx obj))
(else
(gen "UNIMPLEMENTED_OBJECT("
@@ -1400,6 +1403,7 @@ Gambit_Symbol.stringToSymbol = function ( s ) {
return sym;
}
+// Keyword
var Gambit_kwds = {};
function Gambit_Keyword(s) {
s = s + \":\";
@@ -1436,6 +1440,10 @@ function Gambit_toString ( obj ) {
return obj.toString();
else if (obj instanceof Gambit_Vector)
return obj.toString();
+ else if (obj instanceof Gambit_Symbol)
+ return obj.symbolToString();
+ else if (obj instanceof Gambit_Keyword)
+ return obj.keywordToString();
else
return obj;
}
@@ -2503,6 +2511,22 @@ EOF
(compiler-internal-error
"univ-string, unknown target"))))
+(define (univ-symbol ctx obj)
+
+ (case (target-name (ctx-target ctx))
+
+ ((js)
+ (gen (univ-prefix ctx "Symbol.stringToSymbol(")
+ (univ-string ctx (symbol->string obj))
+ ")"))
+
+ ((python ruby php) ;TODO: complete
+ (gen (object->string obj)))
+
+ (else
+ (compiler-internal-error
+ "univ-symbol, unknown target"))))
+
(define (univ-null ctx obj)
(case (target-name (ctx-target ctx))
View
@@ -3,4 +3,4 @@
*/
#define ___STAMP_YMD 20120810
-#define ___STAMP_HMS 152933
+#define ___STAMP_HMS 170027

0 comments on commit 5a7570a

Please sign in to comment.