turning on 'use strict'

This commit is contained in:
Danny Yoo 2011-08-07 20:41:36 -04:00
parent 1026dff4cb
commit 3b427f06c3
7 changed files with 68 additions and 52 deletions

View File

@ -30,6 +30,8 @@
;; the other modules below have some circular dependencies that are resolved
;; by link.
(define files '(
top.js
;; jquery is special: we need to make sure it's resilient against
;; multiple invokation and inclusion.
jquery-protect-header.js
@ -65,6 +67,7 @@
baselib-ports.js
baselib-functions.js
baselib-modules.js
baselib-contmarks.js
baselib-arity.js
baselib-inspectors.js

View File

@ -6,7 +6,7 @@
// Chars
// Char: string -> Char
Char = function(val){
var Char = function(val){
this.val = val;
};
// The characters less than 256 must be eq?, according to the

View File

@ -29,7 +29,20 @@
return [];
};
exports.ContinuationMarkSet = ContinuationMarkSet;
// A continuation prompt tag labels a prompt frame.
var ContinuationPromptTag = function(name) {
this.name = name;
};
exports.ContinuationMarkSet = ContinuationMarkSet;
exports.ContinuationPromptTag = ContinuationPromptTag;
})(this['plt'].baselib);

View File

@ -7,7 +7,7 @@
Empty = function() {
var Empty = function() {
};
Empty.EMPTY = new Empty();
var EMPTY = Empty.EMPTY;

View File

@ -5,7 +5,7 @@
Vector = function(n, initialElements) {
var Vector = function(n, initialElements) {
this.elts = new Array(n);
if (initialElements) {
for (var i = 0; i < n; i++) {

View File

@ -56,6 +56,8 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
var makePrimitiveProcedure = plt.baselib.functions.makePrimitiveProcedure;
var makeClosure = plt.baselib.functions.makeClosure;
var ContinuationPromptTag = plt.baselib.contmarks.ContinuationPromptTag;
// Other helpers
var withArguments = plt.baselib.withArguments;
@ -330,38 +332,6 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
};
// recomputeGas: state number -> number
var recomputeMaxNumBouncesBeforeYield = function(MACHINE, observedDelay) {
// We'd like to see a delay of DESIRED_DELAY_BETWEEN_BOUNCES so
// that we get MACHINE.params.desiredYieldsPerSecond bounces per
// second.
var DESIRED_DELAY_BETWEEN_BOUNCES =
(1000 / MACHINE.params.desiredYieldsPerSecond);
var ALPHA = 50;
var delta = (ALPHA * ((DESIRED_DELAY_BETWEEN_BOUNCES -
observedDelay) /
DESIRED_DELAY_BETWEEN_BOUNCES));
MACHINE.params.maxNumBouncesBeforeYield =
Math.max(MACHINE.params.maxNumBouncesBeforeYield + delta,
1);
};
var HaltError = function(onHalt) {
// onHalt: MACHINE -> void
this.onHalt = onHalt || function(MACHINE) {};
};
var Pause = function(onPause) {
// onPause: MACHINE -> void
this.onPause = onPause || function(MACHINE) {};
};
var PAUSE = function(onPause) {
throw(new Pause(onPause));
};
@ -457,6 +427,44 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
return;
};
// recomputeGas: state number -> number
var recomputeMaxNumBouncesBeforeYield = function(MACHINE, observedDelay) {
// We'd like to see a delay of DESIRED_DELAY_BETWEEN_BOUNCES so
// that we get MACHINE.params.desiredYieldsPerSecond bounces per
// second.
var DESIRED_DELAY_BETWEEN_BOUNCES =
(1000 / MACHINE.params.desiredYieldsPerSecond);
var ALPHA = 50;
var delta = (ALPHA * ((DESIRED_DELAY_BETWEEN_BOUNCES -
observedDelay) /
DESIRED_DELAY_BETWEEN_BOUNCES));
MACHINE.params.maxNumBouncesBeforeYield =
Math.max(MACHINE.params.maxNumBouncesBeforeYield + delta,
1);
};
// These are exception values that are treated specially in the context
// of the trampoline.
var HaltError = function(onHalt) {
// onHalt: MACHINE -> void
this.onHalt = onHalt || function(MACHINE) {};
};
var Pause = function(onPause) {
// onPause: MACHINE -> void
this.onPause = onPause || function(MACHINE) {};
};
var PAUSE = function(onPause) {
throw(new Pause(onPause));
};
//////////////////////////////////////////////////////////////////////
@ -491,22 +499,6 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
var VariableReference = function(prefix, pos) {
this.prefix = prefix;
this.pos = pos;
};
// A continuation prompt tag labels a prompt frame.
var ContinuationPromptTag = function(name) {
this.name = name;
};
// There is a single, distinguished default continuation prompt tag
// that's used to wrap around toplevel prompts.
var DEFAULT_CONTINUATION_PROMPT_TAG =
@ -523,6 +515,13 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
var VariableReference = function(prefix, pos) {
this.prefix = prefix;
this.pos = pos;
};

View File

@ -0,0 +1 @@
"use strict";