From 073688b1a993cc4b26ae53d362519db911dbc66e Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Tue, 29 Mar 2011 18:23:33 -0400 Subject: [PATCH] about to try adding those typechecks. --- assemble-open-coded.rkt | 10 +++++----- runtime.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assemble-open-coded.rkt b/assemble-open-coded.rkt index 8287462..c4c269b 100644 --- a/assemble-open-coded.rkt +++ b/assemble-open-coded.rkt @@ -172,10 +172,10 @@ (let ([test-string (case domain [(number) - (format "typeof(~a) === 'number'" + (format "(typeof(~a) === 'number')" operand-string)] [(string) - (format "typeof(~a) === 'string'" + (format "(typeof(~a) === 'string')" operand-string)] [(list) (format "(~a === [] || (typeof(~a) === 'object' && (~a).length === 2))" @@ -183,10 +183,10 @@ [(pair) (format "(typeof(~a) === 'object' && (~a).length === 2)" operand-string operand-string)])]) - (format "(~a ? ~a : raise(new Error('Expected ' + ~a + ' as argument ' + ~s + ' but received ' + ~a)))" + (format "((~a) ? (~a) : raise(new Error('Expected ' + ~s + ' as argument ' + ~s + ' but received ' + ~a)))" test-string operand-string - domain + (symbol->string domain) pos operand-string))) @@ -209,7 +209,7 @@ (: maybe-typecheck-operand (OperandDomain Natural String CompileTimeEnvironmentEntry -> String)) (define (maybe-typecheck-operand domain-type position operand-string knowledge) (cond - [(redundant-check? domain-type knowledge) + [#t #;(redundant-check? domain-type knowledge) operand-string] [else (assemble-domain-check domain-type operand-string position)])) diff --git a/runtime.js b/runtime.js index 808713b..926afed 100644 --- a/runtime.js +++ b/runtime.js @@ -172,7 +172,7 @@ var Primitives = (function() { }, '/': function(MACHINE, arity) { - if (arity === 0) { raise(new Error();) } + if (arity === 0) { raise(new Error()); } testArgument('number', isNumber, MACHINE.env[MACHINE.env.length - 1],