Merge branch 'racketcon'

Conflicts:

	js-assembler/runtime-src/baselib-functions.js
	racketcon/Makefile
	racketcon/talk.rkt
This commit is contained in:
Danny Yoo 2011-08-03 16:11:56 -04:00
commit 6a13b4401e
5 changed files with 17 additions and 72 deletions

View File

@ -26,10 +26,10 @@
if (! (MACHINE.proc instanceof RUNTIME.Closure)) {
RUNTIME.raiseOperatorIsNotClosure(MACHINE, MACHINE.proc);
}
if (! RUNTIME.isArityMatching(MACHINE.proc.arity, ~a)) {
if (! RUNTIME.isArityMatching(MACHINE.proc.racketArity, ~a)) {
RUNTIME.raiseArityMismatchError(MACHINE,
MACHINE.proc,
MACHINE.proc.arity,
MACHINE.proc.racketArity,
~a);
}
EOF
@ -42,10 +42,10 @@ EOF
if (! (typeof(MACHINE.proc) === 'function')) {
RUNTIME.raiseOperatorIsNotPrimitiveProcedure(MACHINE, MACHINE.proc);
}
if (! RUNTIME.isArityMatching(MACHINE.proc.arity, ~a)) {
if (! RUNTIME.isArityMatching(MACHINE.proc.racketArity, ~a)) {
RUNTIME.raiseArityMismatchError(MACHINE,
MACHINE.proc,
MACHINE.proc.arity,
MACHINE.proc.racketArity,
~a);
}
EOF

View File

@ -176,7 +176,7 @@ EOF
(assemble-oparg (TestPrimitiveProcedure-operand test))
jump)]
[(TestClosureArityMismatch? test)
(format "if (! RUNTIME.isArityMatching((~a).arity, ~a)) { ~a }"
(format "if (! RUNTIME.isArityMatching((~a).racketArity, ~a)) { ~a }"
(assemble-oparg (TestClosureArityMismatch-closure test))
(assemble-oparg (TestClosureArityMismatch-n test))
jump)])

View File

@ -51,10 +51,10 @@
MACHINE.env.push(arguments[arguments.length - 1 - i]);
}
if (! plt.baselib.arity.isArityMatching(v.arity, MACHINE.argcount)) {
if (! plt.baselib.arity.isArityMatching(v.racketArity, MACHINE.argcount)) {
fail(new Error(plt.baselib.format.format(
"arity mismatch: expected ~s arguments, but received ~s",
[v.arity, MACHINE.argcount])));
[v.racketArity, MACHINE.argcount])));
return;
}
@ -76,11 +76,11 @@
succ = succ || function(){};
fail = fail || function(){};
if (! plt.baselib.arity.isArityMatching(v.arity, arguments.length - 2)) {
if (! plt.baselib.arity.isArityMatching(v.racketArity, arguments.length - 2)) {
fail(new Error(
plt.baselib.format.format(
"arity mismatch: expected ~s argument(s) but received ~s",
[v.arity, arguments.length - 2])));
[v.racketArity, arguments.length - 2])));
return;
}
@ -139,7 +139,7 @@
// internallCallDuringPause: call a Racket procedure and get its results.
// The use assumes the machine is in a running-but-paused state.
var internalCallDuringPause = function(MACHINE, proc, success, fail) {
if (! plt.baselib.arity.isArityMatching(proc.arity, arguments.length - 4)) {
if (! plt.baselib.arity.isArityMatching(proc.racketArity, arguments.length - 4)) {
return fail(plt.baselib.exceptions.makeExnFailContractArity("arity mismatch"));
}
@ -223,7 +223,7 @@
// into its text segment.
var Closure = function(label, arity, closedVals, displayName) {
this.label = label; // (MACHINE -> void)
this.arity = arity; // number
this.racketArity = arity; // number
this.closedVals = closedVals; // arrayof number
this.displayName = displayName; // string
};
@ -279,7 +279,7 @@
var makePrimitiveProcedure = function(name, arity, f) {
f.arity = arity;
f.racketArity = arity;
f.displayName = name;
return f;
};
@ -315,14 +315,14 @@
if (isPrimitiveProcedure(f)) {
return makePrimitiveProcedure(
name,
f.arity,
f.racketArity,
function() {
return f.apply(null, arguments);
});
} else {
return new Closure(
f.label,
f.arity,
f.racketArity,
f.closedVals,
name);
}

View File

@ -514,7 +514,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
var installPrimitiveProcedure = function(name, arity, f) {
Primitives[name] = f;
Primitives[name].arity = arity;
Primitives[name].racketArity = arity;
Primitives[name].displayName = name;
};

View File

@ -12,13 +12,13 @@ var checkProcedure = plt.baselib.check.checkProcedure;
// More specific function checkers, based on arity.
var checkProcedure1 = plt.baselib.check.makeCheckArgumentType(
function(x) { return (plt.baselib.functions.isProcedure(x) &&
plt.baselib.arity.isArityMatching(x.arity, 1)); },
plt.baselib.arity.isArityMatching(x.racketArity, 1)); },
'procedure that consumes a world argument');
var checkProcedureWithKey = plt.baselib.check.makeCheckArgumentType(
function(x) { return (plt.baselib.functions.isProcedure(x) &&
plt.baselib.arity.isArityMatching(x.arity, 2)); },
plt.baselib.arity.isArityMatching(x.racketArity, 2)); },
'procedure that consumes a world argument and a key');
@ -107,58 +107,3 @@ EXPORTS['key=?'] =
return k1.toString().toLowerCase() === k2.toString().toLowerCase();
});
// EXPORTS['on-tick'] =
// new CasePrimitive(
// 'on-tick',
// [new PrimProc('on-tick',
// 1,
// false, false,
// function(f) {
// check(f, isFunction, "on-tick", "procedure", 1);
// return new OnTickBang(f,
// new PrimProc('', 1, false, false,
// function(w) { return types.effectDoNothing(); }),
// DEFAULT_TICK_DELAY);
// }),
// new PrimProc('on-tick',
// 2,
// false, false,
// function(f, aDelay) {
// check(f, isFunction, "on-tick", "procedure", 1, arguments);
// check(aDelay, isNumber, "on-tick", "number", 2, arguments);
// return new OnTickBang(f,
// new PrimProc('', 1, false, false,
// function(w) { return types.effectDoNothing(); }),
// aDelay);
// }) ]);
// EXPORTS['on-tick!'] =
// new CasePrimitive('on-tick!',
// [new PrimProc('on-tick!',
// 2,
// false, false,
// function(handler, effectHandler) {
// check(handler, isFunction, "on-tick!", "procedure", 1, arguments);
// check(effectHandler, isFunction, "on-tick!","procedure", 2, arguments);
// return new OnTickBang(handler, effectHandler, DEFAULT_TICK_DELAY);
// }),
// new PrimProc('on-tick!',
// 3,
// false, false,
// function(handler, effectHandler, aDelay) {
// check(handler, isFunction, "on-tick!", "procedure", 1, arguments);
// check(effectHandler, isFunction, "on-tick!","procedure", 2, arguments);
// check(aDelay, isNumber, "on-tick!", "number", 3, arguments);
// return new OnTickBang(handler, effectHandler, aDelay);
// }) ]);