From 702ced8ec92144dd50ac0865aa280486a5471d31 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Sun, 3 Jul 2011 14:37:44 -0400 Subject: [PATCH] ripping out procArityContains --- js-assembler/runtime-src/helpers.js | 38 ++++++----------------------- js-assembler/runtime-src/types.js | 11 +++++++-- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/js-assembler/runtime-src/helpers.js b/js-assembler/runtime-src/helpers.js index a14cd22..df99dbd 100644 --- a/js-assembler/runtime-src/helpers.js +++ b/js-assembler/runtime-src/helpers.js @@ -1,3 +1,10 @@ +// Helper functions for whalesong. +// +// Note: this originally came from js-vm, and may have cruft that +// doesn't belong in whalesong. I need to clean this up. + + + if (! this['plt']) { this['plt'] = {}; } // Helpers library: includes a bunch of helper functions that will be used @@ -159,36 +166,6 @@ if (! this['plt']) { this['plt'] = {}; } }; - var procArityContains = function(n) { - return function(proc) { - var singleCase = function(aCase) { - if ( aCase instanceof types.ContinuationClosureValue ) { - return true; - } - return (aCase.numParams == n || - (aCase.isRest && aCase.numParams <= n)); - }; - - var cases = []; - if ( proc instanceof types.ContinuationClosureValue || - proc instanceof types.ClosureValue || - proc instanceof types.PrimProc ) { - return singleCase(proc); - } - else if (proc instanceof types.CasePrimitive) { - cases = proc.cases; - } - else if (proc instanceof types.CaseLambdaValue) { - cases = proc.closures; - } - - for (var i = 0; i < cases.length; i++) { - if ( singleCase(cases[i]) ) - return true; - } - return false; - } - }; var throwCheckError = function(details, pos, args) { var errorFormatStr; @@ -937,7 +914,6 @@ if (! this['plt']) { this['plt'] = {}; } helpers.reportError = reportError; helpers.raise = raise; - helpers.procArityContains = procArityContains; helpers.throwCheckError = throwCheckError; helpers.isList = isList; helpers.isListOf = isListOf; diff --git a/js-assembler/runtime-src/types.js b/js-assembler/runtime-src/types.js index ce0be15..bd6d8e1 100644 --- a/js-assembler/runtime-src/types.js +++ b/js-assembler/runtime-src/types.js @@ -1,3 +1,10 @@ +// The definitions of the basic types in Whalesong. +// +// Note: this originally came from js-vm, and as a result, +// there's quite a lot of cruft and unused code in this module. +// I need to filter and rip out the values that aren't used in Whalesong. + + if (! this['plt']) { this['plt'] = {}; } // FIXME: there's a circularity between this module and helpers, and that circularly @@ -1244,7 +1251,7 @@ String.prototype.toDisplayedString = function(cache) { newType.type.prototype.invokeEffect = function(aBigBang, k) { var schemeChangeWorld = new PrimProc('update-world', 1, false, false, function(worldUpdater) { - helpers.check(worldUpdater, helpers.procArityContains(1), + //helpers.check(worldUpdater, helpers.procArityContains(1), 'update-world', 'procedure (arity 1)', 1); return new INTERNAL_PAUSE( @@ -2263,7 +2270,7 @@ String.prototype.toDisplayedString = function(cache) { // big bang info to be passed into a make-world-config startup argument var BigBangInfo = makeStructureType('bb-info', false, 2, 0, false, function(args, name, k) { - helpers.check(args[0], helpers.procArityContains(1), name, 'procedure (arity 1)', 1); + //helpers.check(args[0], helpers.procArityContains(1), name, 'procedure (arity 1)', 1); helpers.check(args[1], types.isJsValue, name, 'js-object', 2); return k(args); });