diff --git a/ast-query.sml b/ast-query.sml index 3fa9ef00..e1b7dc5e 100644 --- a/ast-query.sml +++ b/ast-query.sml @@ -97,8 +97,7 @@ fun needFunctionType (t:Ast.TYPE) fun resultTyOfFuncTy t = case (#result (needFunctionType t)) of SOME t => t - (* void case should never occur, I think *) - + | NONE => error ["resultTyOfFuncTy: none found"] val minArgsOfFuncTy = (#minArgs) o needFunctionType diff --git a/boot.sml b/boot.sml index 695dba8b..563386d7 100644 --- a/boot.sml +++ b/boot.sml @@ -272,8 +272,7 @@ fun boot (baseDir:string) : Mach.REGS = val (prog, otherFrags) = loadFiles prog [builtin "Namespace.es", - builtin "Magic.es", - builtin "Internal.es", + builtin "Helper.es", builtin "Conversions.es", @@ -324,11 +323,10 @@ fun boot (baseDir:string) : Mach.REGS = builtin "RegExpEvaluator.es", builtin "RegExp.es", builtin "Date.es", - builtin "MetaObjects.es", (* before JSON *) - builtin "JSON.es", + builtin "MetaObjects.es" + (* builtin "Vector.es", *) - (* builtin "Map.es", *) - builtin "DecimalContext.es" + (* builtin "Map.es" *) ] val glob = diff --git a/builtins/Array.es b/builtins/Array.es index fb5e597c..608227d4 100644 --- a/builtins/Array.es +++ b/builtins/Array.es @@ -38,9 +38,7 @@ * Status: not reviewed against specs. */ - use default namespace public; use namespace intrinsic; - use namespace ECMAScript4_Internal; // Array "extras" from JS1.6 (@todo: and JS1.8 -- reduce/reduceRight) // See http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6#Array_extras diff --git a/builtins/Class.es b/builtins/Class.es index 9e83f308..6b78b56d 100644 --- a/builtins/Class.es +++ b/builtins/Class.es @@ -66,7 +66,7 @@ // intrinsic function superTypes() { // // FIXME #158: don't use "let" here, "let function" is broken. -// var supers = []; // magic::superTypes(this); +// var supers = []; // helper::superTypes(this); // var i = 0; // // Clunky // function next() { diff --git a/builtins/Conversions.es b/builtins/Conversions.es index 8184da35..5e1ecaf7 100644 --- a/builtins/Conversions.es +++ b/builtins/Conversions.es @@ -44,16 +44,16 @@ /* intrinsic function IsPrimitive(value) - magic::isPrimitive(value); + helper::isPrimitive(value); */ /* intrinsic function DefaultValue(obj, preferredType) - magic::defaultValue(obj, preferredType); + helper::defaultValue(obj, preferredType); */ intrinsic function ToPrimitive(value, preferredType) - magic::toPrimitive(value, preferredType); + helper::toPrimitive(value, preferredType); /* * ES-262-3 9.9: ToObject. diff --git a/builtins/Date.es b/builtins/Date.es index 16a5fb88..ca019055 100644 --- a/builtins/Date.es +++ b/builtins/Date.es @@ -43,13 +43,10 @@ * extensive use of expression functions. */ - use namespace ECMAScript4_Internal; use namespace helper; use namespace informative; use namespace intrinsic; - use default namespace public; - const NOARG = {}; dynamic class Date diff --git a/builtins/Error.es b/builtins/Error.es index 43601ce4..8d1b8e8c 100644 --- a/builtins/Error.es +++ b/builtins/Error.es @@ -49,8 +49,6 @@ * verified. */ - use namespace ECMAScript4_Internal; - helper function isExactlyType(obj, t) { // FIXME. What we want is // diff --git a/builtins/Function.es b/builtins/Function.es index 1ecef8df..5bdcfa87 100644 --- a/builtins/Function.es +++ b/builtins/Function.es @@ -46,9 +46,6 @@ * just fine. */ - use namespace __ES4__; - use namespace ECMAScript4_Internal; - public dynamic class Function { // IMPLEMENTATION ARTIFACT: A getter because Function is loaded before int. @@ -56,7 +53,7 @@ /* E262-3 15.3.1: The Function Constructor Called as a Function */ static meta function invoke(...args) - magic::construct(Function, args); + helper::construct(Function, args); /* The following is for the benefit of the specification, don't remove it. @@ -72,7 +69,7 @@ parameters = args.join(","); } body = string(body); - magic::initializeFunction(this, __ES4__::global, parameters, body); + helper::initializeFunction(this, __ES4__::global, parameters, body); } */ @@ -93,11 +90,9 @@ throw new Error("Implementation error"); } - /* XXX: The prototype object behaves like a function (and - system magic makes its classname be "Function", though it's - not an instance of the Function class). So here we install - some things in the prototype that ensures that the object - behaves like a function in some trivial ways. + /* XXX: The prototype object behaves like a function. So here + we install some things in the prototype that ensures that + the object behaves like a function in some trivial ways. */ public prototype meta function invoke(...args) undefined; @@ -133,7 +128,7 @@ thisArg = global; if (argArray === null) argArray = []; - return magic::apply(fn, thisArg, argArray); + return helper::apply(fn, thisArg, argArray); } /* E262-3 15.3.4.4: Function.prototype.call. @@ -184,7 +179,7 @@ throw new TypeError("[[HasInstance]]: prototype is not object"); while (true) { - V = magic::getPrototype(V); + V = helper::getPrototype(V); if (V === null) return false; if (O == V) @@ -203,7 +198,7 @@ // This is a getter because 'double' is not defined by the time we // start constructing Functions. public function get length() - magic::fnLength(this); + helper::fnLength(this); // 'length' is logically a read-only property, so setting it should fail silently public function set length(x) { diff --git a/builtins/GenericFunction.es b/builtins/GenericFunction.es index 24ffcb5d..5611e47f 100644 --- a/builtins/GenericFunction.es +++ b/builtins/GenericFunction.es @@ -103,7 +103,7 @@ (2) The RI has no real meta-object functionality at this point, so this code uses some primitives that have been hacked into the - system as magic hooks. These hooks will eventually be useful + system as helper hooks. These hooks will eventually be useful for the meta-objects system anyhow. (3) Using arrays like I do here is nuts, we should switch to @@ -441,7 +441,7 @@ switch type (v) { case (v:undefined) { return UndefinedType } case (v:null) { return NullType } - case (v:*) { return magic::getClassOfObject(v) } + case (v:*) { return helper::getClassOfObject(v) } } } @@ -487,11 +487,11 @@ let supers = []; switch type (clsOrInterface) { case (cls:Class) { - let probe = magic::getSuperClass(cls); + let probe = helper::getSuperClass(cls); if (probe !== null) supers.push(probe); for ( let i=0 ; ; i++ ) { - let probe = magic::getImplementedInterface(cls, toUint(i)); + let probe = helper::getImplementedInterface(cls, toUint(i)); if (probe === null) break; supers.push(probe); @@ -499,7 +499,7 @@ } case (iface:Interface) { for ( let i=0 ; ; i++ ) { - let probe = magic::getSuperInterface(iface, toUint(i)); + let probe = helper::getSuperInterface(iface, toUint(i)); if (probe === null) break; supers.push(probe); diff --git a/builtins/Global.es b/builtins/Global.es index 629ea0f1..ceaa1115 100644 --- a/builtins/Global.es +++ b/builtins/Global.es @@ -39,8 +39,6 @@ * Status: not reviewed against specs. */ - use namespace ECMAScript4_Internal; - // 15.1.1.1 NaN // 15.1.1.2 Infinity // 15.1.1.3 undefined @@ -80,7 +78,7 @@ { initial_obj = (v is Object) ? v : null; current_obj = initial_obj; - current_ids = magic::getEnumerableIds(initial_obj); + current_ids = helper::getEnumerableIds(initial_obj); } // FIXME: why no ResultFun, boolean args? @@ -101,24 +99,24 @@ throw iterator::StopIteration; // No more properties in current_obj: try walking up the prototype chain. - current_obj = magic::getPrototype(current_obj); + current_obj = helper::getPrototype(current_obj); if (current_obj === null) throw iterator::StopIteration; - current_ids = magic::getEnumerableIds(current_obj); + current_ids = helper::getEnumerableIds(current_obj); current_index = 0; } let id : EnumerableId = current_ids[current_index++]; // Check for a shadowing property from initial_obj to current_obj on the prototype chain. - for (let obj : Object = initial_obj; obj !== current_obj; obj = magic::getPrototype(obj)) { - if (magic::hasOwnProperty(obj, id)) + for (let obj : Object = initial_obj; obj !== current_obj; obj = helper::getPrototype(obj)) { + if (helper::hasOwnProperty(obj, id)) continue loop; } // Check whether name is still bound in order to skip deleted properties. - if (magic::hasOwnProperty(current_obj, id)) + if (helper::hasOwnProperty(current_obj, id)) return result_fun(id, initial_obj); } } @@ -166,15 +164,15 @@ this.send(undefined) public function send(i) - magic::genSend(this, i) + helper::genSend(this, i) public function throw_(e) - magic::genThrow(this, e) + helper::genThrow(this, e) public function close() : void - magic::genClose(this) + helper::genClose(this) - // FIXME: this gets trumped by Mach.magicToUstring + // FIXME: this gets trumped by Mach.primitiveToUstring //public function toString() // "[object Generator]" } @@ -182,7 +180,7 @@ // 15.1.2.1 eval (x) // // FIXME: This should probably be an intrinsic::eval that looks - // like public::eval below but which delegates to magic::eval, + // like public::eval below but which delegates to helper::eval, // passing "this function" as the object from which to extract the // scope chain. diff --git a/builtins/Magic.es b/builtins/Helper.es similarity index 59% rename from builtins/Magic.es rename to builtins/Helper.es index 7025d610..eb0aa06d 100644 --- a/builtins/Magic.es +++ b/builtins/Helper.es @@ -1,6 +1,6 @@ /* -*- mode: java; indent-tabs-mode: nil -*- * - * ECMAScript 4 builtins - magic functions + * ECMAScript 4 builtins - miscellaneous helper functions * * The following licensing terms and conditions apply and must be * accepted in order to use the Reference Implementation: @@ -33,27 +33,6 @@ * Copyright (c) 2007 Adobe Systems Inc., The Mozilla Foundation, Opera * Software ASA, and others. * - * - * Magic functions are implementation traps that express aspects of - * the language that cannot be expressed without either (a) modeling - * the language in the language, eg, by modeling objects and their - * property lists, or (b) breaking security. - * - * A good example is [[Prototype]], which exists on all objects but - * which is presumed not to be available for reading or writing by the - * user program. We can model it directly using eg ___proto___, but - * not without creating facilities that are presumed not to exist - * (reading that field). - * - * Library code references magic functions as global functions in the - * "magic" namespace, eg "magic::getPrototype(o)". - * - * Do note that a conforming implementation can't express the magic - * hooks quite like shown here because the magic namespace pollutes - * the name space for user programs. An implementation might instead - * supply a flag --magic to the compiler that allows the compiler to - * magically know about "magic" when the library files are being - * compiled. */ use namespace intrinsic; @@ -66,7 +45,7 @@ * protocol for it (and its base classes, initializers, settings, * ctors). Return the resulting instance, always an Object! */ - magic native function construct(cls:Class!, args:[*]) : Object!; + helper native function construct(cls:Class!, args:[*]) : Object!; /* -------------------------------------------------------------- @@ -74,45 +53,45 @@ PROPERTY MANIPULATION. */ /* Retrieve the [[Class]] property of o */ - magic native function getClassName(o : Object!) : string; + informative native function getClassName(o : Object!) : string; /* Retrieve the class object of o */ - magic native function getClassOfObject(o : Object!) : Class; + helper native function getClassOfObject(o : Object!) : Class; /* Retrieve the base class of cls, or null. */ - magic native function getSuperClass(cls : Class!) : Class; + helper native function getSuperClass(cls : Class!) : Class; /* Retrieve the kth implemented interface of cls, or null. */ - magic native function getImplementedInterface(cls: Class!, k: double) : Interface; + helper native function getImplementedInterface(cls: Class!, k: double) : Interface; /* Retrieve the kth superinterface of iface, or null. */ - magic native function getSuperInterface(iface: Interface!, k: double) : Interface; + helper native function getSuperInterface(iface: Interface!, k: double) : Interface; /* Retrieve the array of enumerable properties of o, in property creation order. */ - magic native function getEnumerableIds(o : Object) : Array; // FIXME: EnumerableIdArray + helper native function getEnumerableIds(o : Object) : Array; // FIXME: EnumerableIdArray /* Retrieve the possibly null [[Prototype]] property of o */ - magic native function getPrototype(o : Object!) : Object; + helper native function getPrototype(o : Object!) : Object; /* Return true iff o has a local property named by p. */ - magic native function hasOwnProperty(o : Object!, p : (Name|string)) : boolean; + helper native function hasOwnProperty(o : Object!, p : (Name|string)) : boolean; /* Return true if the property p does exists locally on o and its Enumerable bit is set */ - magic native function getPropertyIsEnumerable(o : Object!, p : (Name|string)) : boolean; + helper native function getPropertyIsEnumerable(o : Object!, p : (Name|string)) : boolean; /* Return true if the property p does exists locally on o and its Removable bit is set */ - magic native function getPropertyIsRemovable(o : Object!, p : (Name|string)) : boolean; + helper native function getPropertyIsRemovable(o : Object!, p : (Name|string)) : boolean; /* Provided that the property p exists locally on o, set its Enumerable flag according to f. If the property p does not exist locally on o, it does nothing. */ - magic native function setPropertyIsEnumerable(o : Object!, p : (Name|string), f : boolean) : void; + helper native function setPropertyIsEnumerable(o : Object!, p : (Name|string), f : boolean) : void; - magic native function isPrimitive(v:*) : boolean; - magic native function toPrimitive(v:*, hint:string) : *; - magic native function defaultValue(ob:Object!, hint:string) : *; + helper native function isPrimitive(v:*) : boolean; + helper native function toPrimitive(v:*, hint:string) : *; + helper native function defaultValue(ob:Object!, hint:string) : *; /* ---------------------------------------------------------------- @@ -120,42 +99,42 @@ /* Given a function object, a this object, and an array of argument values, call the function with the this object and arguments. */ - magic native function apply(fn : Function!, t : Object!, args : Array) : *; + helper native function apply(fn : Function!, t : Object!, args : Array) : *; - magic native function fnLength(fn: Function!) : double; + helper native function fnLength(fn: Function!) : double; /* ---------------------------------------------------------------- GENERATOR MANIPULATION. */ - magic native function genSend(g : Object!, x : *) : *; + helper native function genSend(g : Object!, x : *) : *; - magic native function genThrow(g : Object!, x : *) : *; + helper native function genThrow(g : Object!, x : *) : *; - magic native function genClose(g : Object!) : *; + helper native function genClose(g : Object!) : *; /* ---------------------------------------------------------------- STRING MANIPULATION. Strings contain string data in some unspecified way - there is no representation of string data in - the language. The following magic functions access and set + the language. The following helper functions access and set those string data. */ /* Given a string and a position in that string, return the numeric value of the character at that position in the string. */ - magic native function charCodeAt(s : string, pos : double) : double; + informative native function charCodeAt(s : string, pos : double) : double; /* Given a numeric character value, return a string of length 1 whose element 0 is the character with that same value. */ - magic native function fromCharCode(ch : double) : string; + informative native function fromCharCode(ch : double) : string; /* Given a string object, return the number of characters in the * string. */ - magic native function stringLength(s : string) : double; + informative native function stringLength(s : string) : double; /* Given two string objects A and B , return a new string object containing the characters from A followed by the characters from B. */ - magic native function stringAppend(a : string, b : string) : string; + informative native function stringAppend(a : string, b : string) : string; diff --git a/builtins/Map.es b/builtins/Map.es index c8488ab7..4722aea1 100644 --- a/builtins/Map.es +++ b/builtins/Map.es @@ -69,8 +69,6 @@ * to create it. */ - use namespace ECMAScript4_Internal; - __ES4__ dynamic class Map. { static public const length = 2; diff --git a/builtins/Math.es b/builtins/Math.es index f522535f..09900e9a 100644 --- a/builtins/Math.es +++ b/builtins/Math.es @@ -40,11 +40,10 @@ * by a strongly-typed global intrinsic const variable also called * "Math", and for intrinsic methods on objects of this type. */ - - use namespace ECMAScript4_Internal; use namespace intrinsic; + use namespace helper; - ECMAScript4_Internal namespace MathInternals; + helper namespace MathInternals; type AnyNumber = (double|decimal); type FloatNumber = (double|decimal); diff --git a/builtins/MetaObjects.es b/builtins/MetaObjects.es index 88a1fa70..c2ca2108 100644 --- a/builtins/MetaObjects.es +++ b/builtins/MetaObjects.es @@ -34,7 +34,6 @@ */ - use namespace ECMAScript4_Internal; use namespace helper; use namespace intrinsic; @@ -92,7 +91,7 @@ return nulltype; if (v is undefined) return undefinedtype; - return getClassMetaObject(magic::getClassOfObject(v)); + return getClassMetaObject(helper::getClassOfObject(v)); } intrinsic interface NullType extends Type @@ -149,14 +148,14 @@ function pushClass(cls) { if (cls !== null) { supers.push(getClassMetaObject(cls)); - pushClass(magic::getSuperClass(cls)); + pushClass(helper::getSuperClass(cls)); } } function pushSuperInterfaces(iface) { let i = 0; while (true) { - let iface2 = magic::getSuperInterface(iface, toUint(i)); + let iface2 = helper::getSuperInterface(iface, toUint(i)); if (iface2 == null) break; supers.push(getInterfaceMetaObject(iface2)); @@ -168,7 +167,7 @@ function pushImplementedInterfaces(cls) { let i = 0; while (true) { - let iface = magic::getImplementedInterface(cls, toUint(i)); + let iface = helper::getImplementedInterface(cls, toUint(i)); if (iface == null) break; supers.push(getInterfaceMetaObject(iface)); @@ -240,7 +239,7 @@ return; supers = []; - pushClass(magic::getSuperClass(cls)); + pushClass(helper::getSuperClass(cls)); pushImplementedInterfaces(cls); } } diff --git a/builtins/Name.es b/builtins/Name.es index 9d4c5f42..cde2b39c 100644 --- a/builtins/Name.es +++ b/builtins/Name.es @@ -35,8 +35,6 @@ * */ - use namespace ECMAScript4_Internal; - __ES4__ final class Name extends String { // IMPLEMENTATION ARTIFACT: A getter because Name is loaded before int. diff --git a/builtins/Namespace.es b/builtins/Namespace.es index cae1e188..43147352 100644 --- a/builtins/Namespace.es +++ b/builtins/Namespace.es @@ -46,7 +46,7 @@ // function here for dynamic namespaces. Not a ctor! // // For bootstrapping purposes, the ctor of Namespace must *not* - // call magic::foo on any foo, since it'll feed back on itself - // during construction of the magic namespace itself. So we + // call helper::foo on any foo, since it'll feed back on itself + // during construction of the helper namespace itself. So we // insist on an empty ctor for the time being. } diff --git a/builtins/Number.es b/builtins/Number.es index f555709c..64a32420 100644 --- a/builtins/Number.es +++ b/builtins/Number.es @@ -43,9 +43,6 @@ */ use namespace intrinsic; - use namespace ECMAScript4_Internal; - - use default namespace public; __ES4__ type AnyNumber = (double|decimal|Number!); diff --git a/builtins/Object.es b/builtins/Object.es index 1c36c3fd..1801d72e 100644 --- a/builtins/Object.es +++ b/builtins/Object.es @@ -40,9 +40,6 @@ * Status: Complete; Not reviewed against spec. */ - - use namespace ECMAScript4_Internal; - public dynamic class Object { // IMPLEMENTATION ARTIFACT: A getter because Object is loaded before int. @@ -68,7 +65,7 @@ "[object " + helper::getClassName() + "]"; helper function getClassName() - magic::getClassName(this); + informative::getClassName(this); /* E262-3 15.2.4.3: Object.prototype.toLocaleString */ public prototype function toLocaleString() @@ -96,14 +93,14 @@ public prototype function hasOwnProperty(name) this.private::hasOwnProperty(helper::toEnumerableId(name)); - // Bootstrapping barfs if this does not go directly to the magic, + // Bootstrapping barfs if this does not go directly to the helper, // though I don't know why. Could be that Object is not fully // set up yet when it's called. intrinsic function hasOwnProperty(name: EnumerableId): boolean - magic::hasOwnProperty(this, name); + helper::hasOwnProperty(this, name); private function hasOwnProperty(name: EnumerableId): boolean - magic::hasOwnProperty(this, name); + helper::hasOwnProperty(this, name); /* E262-3 15.2.4.6: Object.prototype.isPrototypeOf */ @@ -119,7 +116,7 @@ let obj = value; while (true) { - obj = magic::getPrototype(obj); + obj = helper::getPrototype(obj); if (obj === null || obj === undefined) return false; if (obj === this) @@ -137,9 +134,9 @@ private::propertyIsEnumerable(name); private function propertyIsEnumerable(name) { - if (!magic::hasOwnProperty(this, name)) + if (!helper::hasOwnProperty(this, name)) return false; - return !magic::getPropertyIsEnumerable(this, name); + return !helper::getPropertyIsEnumerable(this, name); } /* Old code @@ -151,13 +148,13 @@ private::propertyIsEnumerable(name, flag); private function propertyIsEnumerable(name, flag) { - if (!magic::hasOwnProperty(this, name)) + if (!helper::hasOwnProperty(this, name)) return false; - let oldval = !magic::getPropertyIsEnumerable(this, name); - if (!magic::getPropertyIsDontDelete(this, name)) + let oldval = !helper::getPropertyIsEnumerable(this, name); + if (!helper::getPropertyIsDontDelete(this, name)) if (flag !== undefined) - magic::setPropertyIsEnumerable(this, name, !flag); + helper::setPropertyIsEnumerable(this, name, !flag); return oldval; } */ @@ -173,19 +170,19 @@ private::__defineProperty__(name, value, enumerable, removable, writable); private function __defineProperty__(name, value, enumerable, removable, writable) { - if (!magic::hasOwnProperty(this, name)) + if (!helper::hasOwnProperty(this, name)) throw new TypeError(/* Property exists */); - let obj = magic::getPrototype(this); + let obj = helper::getPrototype(this); while (obj != null) { - if (magic::hasOwnProperty(obj, name) && !magic::getPropertyIsWritable(obj, name)) + if (helper::hasOwnProperty(obj, name) && !helper::getPropertyIsWritable(obj, name)) throw new TypeError(/* non-Writable property in prototype chain */); - obj = magic::getPrototype(obj); + obj = helper::getPrototype(obj); } this[name] = value; - magic::setPropertyIsEnumerable(this, name, enumerable); - magic::setPropertyIsRemovable(this, name, removable); - magic::setPropertyIsWritable(this, name, writable); + helper::setPropertyIsEnumerable(this, name, enumerable); + helper::setPropertyIsRemovable(this, name, removable); + helper::setPropertyIsWritable(this, name, writable); } } diff --git a/builtins/RegExp.es b/builtins/RegExp.es index 1fa96743..c5316020 100644 --- a/builtins/RegExp.es +++ b/builtins/RegExp.es @@ -42,12 +42,10 @@ * See RegExpEvaluator.es for the evaluator and compiled code representation. */ - use namespace ECMAScript4_Internal; + use namespace helper; use namespace intrinsic; use namespace Unicode; use namespace RegExpInternals; - - use default namespace public; /* E262-3 15.10: Regular expression object */ public dynamic class RegExp diff --git a/builtins/RegExpCompiler.es b/builtins/RegExpCompiler.es index 43940631..7e661633 100644 --- a/builtins/RegExpCompiler.es +++ b/builtins/RegExpCompiler.es @@ -48,7 +48,7 @@ * start with the digit '0'. */ - use namespace ECMAScript4_Internal; + use namespace helper; use namespace intrinsic; use namespace Unicode; use namespace RegExpInternals; @@ -466,7 +466,7 @@ let (t : double? = decimalEscape()) { if (t !== null) - return new CharsetAdhoc(string.fromCharCode(t)); + return new CharsetAdhoc(string.intrinsic::fromCharCode(t)); } fail( SyntaxError, "Failed to match escape sequence " + peekChar() ); @@ -551,11 +551,11 @@ let (c : string = peekChar()) { if (c >= "A" && c <= "Z") { eat(c); - return string.fromCharCode(c.charCodeAt(0) - "A".charCodeAt(0) + 1); + return string.intrinsic::fromCharCode(c.charCodeAt(0) - "A".charCodeAt(0) + 1); } if (c >= "a" && c <= "z") { eat(c); - return string.fromCharCode(c.charCodeAt(0) - "a".charCodeAt(0) + 1); + return string.intrinsic::fromCharCode(c.charCodeAt(0) - "a".charCodeAt(0) + 1); } else return "c"; @@ -582,7 +582,7 @@ res = hexDigits(4); if (res === null) { idx = saved; - res = string.fromCharCode(c); + res = string.intrinsic::fromCharCode(c); } return res; } @@ -679,7 +679,7 @@ if (n !== null && i < m || i == 0) return null; skip(); - return string.fromCharCode(k); + return string.intrinsic::fromCharCode(k); } function decimalDigits() : double { @@ -705,7 +705,7 @@ // no faster than peekChar. In our reference // implementation, it is substantially faster. if (idx < slen) - return magic::charCodeAt(source, intrinsic::toUint(idx)); + return informative::charCodeAt(source, intrinsic::toUint(idx)); else return 0x0; } diff --git a/builtins/RegExpEvaluator.es b/builtins/RegExpEvaluator.es index 9a5a32dc..6071a1bc 100644 --- a/builtins/RegExpEvaluator.es +++ b/builtins/RegExpEvaluator.es @@ -40,7 +40,7 @@ * Status: Complete, not reviewed, not tested. */ - use namespace ECMAScript4_Internal; + use namespace helper; use namespace intrinsic; use namespace RegExpInternals; use default namespace RegExpInternals; @@ -467,7 +467,7 @@ let lo_code = lo.charCodeAt(0); let hi_code = hi.charCodeAt(0); for ( let i=lo_code ; i <= hi_code ; i++ ) - if (Canonicalize(ctx, string.fromCharCode(i)) == c) + if (Canonicalize(ctx, string.intrinsic::fromCharCode(i)) == c) return true; return false; } diff --git a/builtins/String.es b/builtins/String.es index 1e976d38..99d5c0f8 100644 --- a/builtins/String.es +++ b/builtins/String.es @@ -42,22 +42,20 @@ * Status: complete; not reviewed; not tested. * * Strings are constructed by: - * new String + magic::setStringValue - * magic::fromCharCode - * magic::stringAppend + * new String + helper::setStringValue + * helper::fromCharCode + * helper::stringAppend * * A string's length is obtained by: - * magic::stringLength + * helper::stringLength * * Strings are picked apart by: - * magic::charCodeAt + * helper::charCodeAt * - * (We would expect "+" to map to magic::stringAppend().) + * (We would expect "+" to map to helper::stringAppend().) */ - use default namespace public; use namespace intrinsic; - use namespace ECMAScript4_Internal; __ES4__ type AnyString = (string|String!); diff --git a/builtins/Unicode.es b/builtins/Unicode.es index 591fc0b4..7bac2d4f 100644 --- a/builtins/Unicode.es +++ b/builtins/Unicode.es @@ -33,7 +33,7 @@ * */ - use namespace ECMAScript4_Internal; + use namespace helper; use namespace intrinsic; use namespace Unicode; use default namespace Unicode; diff --git a/builtins/UnicodeCasemapping.es b/builtins/UnicodeCasemapping.es index bc3f2dd7..4713b78c 100644 --- a/builtins/UnicodeCasemapping.es +++ b/builtins/UnicodeCasemapping.es @@ -1,6 +1,6 @@ /* Generated by ../unicode/casemapping.as */ - use namespace ECMAScript4_Internal; + use namespace helper; use default namespace Unicode; var upperTbl = []; diff --git a/builtins/UnicodeTbl.es b/builtins/UnicodeTbl.es index 0ad0fcae..4719121a 100644 --- a/builtins/UnicodeTbl.es +++ b/builtins/UnicodeTbl.es @@ -53,7 +53,7 @@ * The raw unicode character data and the scripts to process them are * in the directory ../unicode. */ - use namespace ECMAScript4_Internal; + use namespace helper; use namespace intrinsic; use namespace Unicode; use default namespace Unicode; diff --git a/builtins/Vector.es b/builtins/Vector.es index a607fc05..791f612c 100644 --- a/builtins/Vector.es +++ b/builtins/Vector.es @@ -37,8 +37,6 @@ * Status: not reviewed against specs, not tested. */ - use namespace ECMAScript4_Internal; - __ES4__ class Vector. { public function Vector(length: double=0, fixed: boolean=false) @@ -500,5 +498,4 @@ private const storage = new Array(); } -} diff --git a/builtins/boolean_primitive.es b/builtins/boolean_primitive.es index dd30a543..04e0b205 100644 --- a/builtins/boolean_primitive.es +++ b/builtins/boolean_primitive.es @@ -45,7 +45,7 @@ /* * The boolean class is final and non-dynamic because most * implementations will in fact represent boolean objects not - * using objects, but using some magic tagged value, of which + * using objects, but using some primitive tagged value, of which * there will be only two, one for "true" and the other for * "false". * @@ -58,7 +58,7 @@ /* Don't remove this function boolean(value=false) - magic::newBoolean(value) + helper::newBoolean(value) */ /* E262-3 15.6.1: The boolean Constructor Called as a Function. */ diff --git a/builtins/decimal.es b/builtins/decimal.es index f41ea5bc..bcdd98be 100644 --- a/builtins/decimal.es +++ b/builtins/decimal.es @@ -41,9 +41,7 @@ * Status: Incomplete (toExponential, toPrecision, toFixed; constants); not reviewed; not tested. */ - use default namespace public; use namespace intrinsic; - use namespace ECMAScript4_Internal; // The [[Prototype]] of "decimal" is Number.[[Prototype]] // Don't add prototype methods or properties here! @@ -71,7 +69,7 @@ /* Don't remove this function decimal(value=false) - magic::newDecimal(value) + helper::newDecimal(value) */ /* E262-3 15.7.1.1: The decimal Constructor Called as a Function */ diff --git a/builtins/double.es b/builtins/double.es index 57e0086f..ce339177 100644 --- a/builtins/double.es +++ b/builtins/double.es @@ -46,9 +46,7 @@ * might be done. */ - use default namespace public; use namespace intrinsic; - use namespace ECMAScript4_Internal; // The [[Prototype]] of "double" is Number.[[Prototype]] // Don't add prototype methods or properties here! @@ -74,7 +72,7 @@ /* Don't remove this function double(value=false) - magic::newDouble(value) + helper::newDouble(value) */ /* E262-3 15.7.1.1: The double Constructor Called as a Function */ diff --git a/builtins/string_primitive.es b/builtins/string_primitive.es index de93a0cd..41828906 100644 --- a/builtins/string_primitive.es +++ b/builtins/string_primitive.es @@ -45,17 +45,17 @@ * Status: incomplete; not reviewed; not tested. * * Strings are constructed by: - * new string + magic::setStringValue - * magic::fromCharCode - * magic::stringAppend + * the primitive string ctor + * informative::fromCharCode + * informative::stringAppend * * A string's length is obtained by: - * magic::stringLength + * informative::stringLength * * strings are picked apart by: - * magic::charCodeAt + * informative::charCodeAt * - * (We would expect "+" to map to magic::stringAppend().) + * (We would expect "+" to map to informative::stringAppend().) * * Note, most string functions are "generic". This is implemented as * either a static method on the "string" class that treats a "self" @@ -65,9 +65,8 @@ * type of "this". */ - use default namespace public; + use namespace helper; use namespace intrinsic; - use namespace ECMAScript4_Internal; use namespace Unicode; use namespace RegExpInternals; @@ -82,7 +81,7 @@ /* Don't remove this function string(value="") - magic::newString(value) + helper::newString(value) */ /* E262-3 15.5.3.2: String.fromCharCode @@ -100,7 +99,7 @@ helper static function fromCharCode(codes: Array): string { let s = ""; for (let i=0, limit=codes.length ; i < limit ; ++i) - s += magic::fromCharCode(intrinsic::toUint(codes[i] & 0x1FFFFF)); + s += informative::fromCharCode(intrinsic::toUint(codes[i] & 0x1FFFFF)); return s; } @@ -142,7 +141,7 @@ let ipos = helper::toInteger(pos); if (ipos < 0 || ipos >= S.length) return ""; - return magic::fromCharCode(magic::charCodeAt(S, intrinsic::toUint(ipos))); + return informative::fromCharCode(informative::charCodeAt(S, intrinsic::toUint(ipos))); } @@ -158,7 +157,7 @@ let ipos = helper::toInteger(pos); if (ipos < 0 || ipos >= S.length) return NaN; - return magic::charCodeAt(S, intrinsic::toUint(ipos)); + return informative::charCodeAt(S, intrinsic::toUint(ipos)); } @@ -213,7 +212,7 @@ outer: for ( let k = m ; k < lim ; k++ ) { for ( let w = 0 ; w < sslen ; w++ ) { - if (magic::charCodeAt(S, intrinsic::toUint(k+w)) !== magic::charCodeAt(SS, intrinsic::toUint(w))) + if (informative::charCodeAt(S, intrinsic::toUint(k+w)) !== informative::charCodeAt(SS, intrinsic::toUint(w))) continue outer; } return k; @@ -248,7 +247,7 @@ outer: for ( let k = Math.min(m, slen-sslen) ; k >= 0 ; k-- ) { for ( let w = 0 ; w < sslen ; w++ ) { - if (magic::charCodeAt(S, intrinsic::toUint(k+w)) !== magic::charCodeAt(SS, intrinsic::toUint(w))) + if (informative::charCodeAt(S, intrinsic::toUint(k+w)) !== informative::charCodeAt(SS, intrinsic::toUint(w))) continue outer; } return k; @@ -670,12 +669,12 @@ let s = ""; for ( let i=0, limit=S.length ; i < limit ; i++ ) { - let u = Unicode::toLowerCaseCharCode(magic::charCodeAt(S,intrinsic::toUint(i))); + let u = Unicode::toLowerCaseCharCode(informative::charCodeAt(S,intrinsic::toUint(i))); if (u is double) - s += magic::fromCharCode(intrinsic::toUint(u)); + s += informative::fromCharCode(intrinsic::toUint(u)); else { for ( let j=0 ; j < u.length ; j++ ) - s += magic::fromCharCode(u[j]); + s += informative::fromCharCode(u[j]); } } return s; @@ -714,12 +713,12 @@ let s = ""; for ( let i=0, limit=S.length ; i < limit ; i++ ) { - let u = Unicode::toUpperCaseCharCode(magic::charCodeAt(S,intrinsic::toUint(i))); + let u = Unicode::toUpperCaseCharCode(informative::charCodeAt(S,intrinsic::toUint(i))); if (u is double) - s += magic::fromCharCode(intrinsic::toUint(u)); + s += informative::fromCharCode(intrinsic::toUint(u)); else { for ( let j=0 ; j < u.length ; j++ ) - s += magic::fromCharCode(u[j]); + s += informative::fromCharCode(u[j]); } } return s; @@ -773,7 +772,7 @@ /* E262-3 15.5.5.1: length. */ function get length() : double - magic::stringLength(this); + informative::stringLength(this); /* Catchall indexing operation. */ meta function get(pos) { diff --git a/defn.sml b/defn.sml index 1b61d17c..a63f8f98 100644 --- a/defn.sml +++ b/defn.sml @@ -126,37 +126,29 @@ type ENV = val (initRib:Ast.RIB) = [ (* This is the new name that non-backward-compatibly pollutes the ES3 unqualified global. *) - (Ast.PropName Name.public_ES4_, Ast.NamespaceFixture Name.ES4NS), + (Ast.PropName Name.public_ES4, Ast.NamespaceFixture Name.ES4NS), (* These are the namespaces in ES4 that have spec-defined, normative roles and meanings. *) - (Ast.PropName Name.ES4_public_, Ast.NamespaceFixture Name.publicNS), - (Ast.PropName Name.ES4_meta_, Ast.NamespaceFixture Name.metaNS), - (Ast.PropName Name.ES4_magic_, Ast.NamespaceFixture Name.magicNS), - (Ast.PropName Name.ES4_intrinsic_, Ast.NamespaceFixture Name.intrinsicNS), + (Ast.PropName Name.ES4_public, Ast.NamespaceFixture Name.publicNS), + (Ast.PropName Name.ES4_meta, Ast.NamespaceFixture Name.metaNS), + (Ast.PropName Name.ES4_intrinsic, Ast.NamespaceFixture Name.intrinsicNS), (* - * This is the namespace in ES4 that holds all additional non-normative namespaces of the - * standard library - *) - - (Ast.PropName Name.ES4_ECMAScript4_Internal_, Ast.NamespaceFixture Name.ECMAScript4_InternalNS), - - (* - * This is a namespace that *would* be defined in the standard library except that we - * define a bunch of native methods in it, and therefore wish to have access to it here. - * In theory we could back off and look it up once the interpreter boots. It's just here + * These are a namespaces that *would* be defined in the standard library except that we + * define a bunch of native methods in them, and therefore wish to have access to them here. + * In theory we could back off and look it up once the interpreter boots. They're just here * to be convenient. *) - (Ast.PropName Name.ECMAScript4_Internal_informative_, Ast.NamespaceFixture Name.informativeNS), + (Ast.PropName Name.ES4_helper, Ast.NamespaceFixture Name.helperNS), + (Ast.PropName Name.ES4_informative, Ast.NamespaceFixture Name.informativeNS), (* * These are namespaces that *could* be defined in the boot process, but that code is * sufficiently tangly and order-sensitive that it's much easier to define them here. *) - (Ast.PropName Name.ECMAScript4_Internal_helper_, Ast.NamespaceFixture Name.helperNS), - (Ast.PropName Name.ECMAScript4_Internal_Unicode_, Ast.NamespaceFixture Name.UnicodeNS), - (Ast.PropName Name.ECMAScript4_Internal_RegExpInternals_, Ast.NamespaceFixture Name.RegExpInternalsNS) + (Ast.PropName Name.ES4_Unicode, Ast.NamespaceFixture Name.UnicodeNS), + (Ast.PropName Name.ES4_RegExpInternals, Ast.NamespaceFixture Name.RegExpInternalsNS) ] @@ -257,6 +249,9 @@ and defNameExpr (env:ENV) | Ast.QualifiedName { namespace, identifier } => Ast.QualifiedName { namespace = defNamespaceExpr env namespace, identifier = identifier } + + | Ast.ResolvedName name => + Ast.ResolvedName name end fun resolve (env:ENV) diff --git a/eval.sml b/eval.sml index 18b81ea4..6e5afd5f 100644 --- a/eval.sml +++ b/eval.sml @@ -1454,7 +1454,7 @@ and newNativeFunction (regs:Mach.REGS) and getIteratorNamespace (regs:Mach.REGS) : Ast.NAMESPACE = - Mach.needNamespace (getValue regs (#global regs) Name.ES4_iterator_) + Mach.needNamespace (getValue regs (#global regs) Name.ES4_iterator) and getStopIteration (regs:Mach.REGS) = getValue regs (#global regs) { id = Ustring.StopIteration_, diff --git a/fixture.sml b/fixture.sml index a9de5c25..0808b121 100755 --- a/fixture.sml +++ b/fixture.sml @@ -388,6 +388,7 @@ and resolveNameExpr (ribs:Ast.RIBS) [] => error ["qualified name not present in ribs: ", LogErr.name name] | (rib::ribs) => ((rib::ribs), name, (getFixture rib (Ast.PropName name))) end + | Ast.ResolvedName { ns, id } => resolveNameExpr ribs (Ast.QualifiedName { namespace=(Ast.Namespace ns), identifier=id }) | Ast.UnqualifiedName { identifier, openNamespaces, globalNames } => case findName (ribs, identifier, openNamespaces, globalNames) of NONE => error ["unable to resolve unqualified name expression: ", LogErr.nameExpr ne] diff --git a/logerr.sml b/logerr.sml index d05236dc..fd07dd30 100644 --- a/logerr.sml +++ b/logerr.sml @@ -149,6 +149,7 @@ and nameExpr (ne:Ast.NAME_EXPRESSION) = unqualName openNamespaces identifier | Ast.QualifiedName { namespace, identifier } => ((nsExpr namespace) ^ "::" ^ (Ustring.toAscii identifier)) + | Ast.ResolvedName n => name n end fun identList fields = diff --git a/mach.sml b/mach.sml index a989d904..cf8e0a2d 100644 --- a/mach.sml +++ b/mach.sml @@ -1295,9 +1295,9 @@ fun findName (globalObj: OBJECT, objects: OBJECT list, identifier: IDENTIFIER, o case Fixture.selectNamespacesByGlobalNames (identifier, matches''', globalNames) of namespace :: [] => SOME (object, {ns=namespace,id=identifier}) | [] => raise (LogErr.NameError "internal error") - | _ => raise (LogErr.NameError "ambiguous reference") + | _ => raise (LogErr.NameError ("ambiguous reference: " ^ Ustring.toAscii identifier)) else - raise (LogErr.NameError "ambiguous reference") + raise (LogErr.NameError ("ambiguous reference: " ^ Ustring.toAscii identifier)) end end end diff --git a/name.sml b/name.sml index 883e9804..188b03a8 100644 --- a/name.sml +++ b/name.sml @@ -55,7 +55,6 @@ fun meta (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = metaNS } fun magic (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = magicNS } fun intrinsic (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = intrinsicNS } fun helper (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = helperNS } -fun ECMAScript4_Internal (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = ECMAScript4_InternalNS } fun informative (id:Ast.IDENTIFIER) : Ast.NAME = { id = id, ns = informativeNS } (* @@ -247,31 +246,32 @@ val intrinsic_get = intrinsic Ustring.get_ val intrinsic_DaylightSavingsTA = intrinsic Ustring.DaylightSavingsTA_ val intrinsic_LocalTZA = intrinsic Ustring.LocalTZA_ -val magic_stringAppend = magic Ustring.stringAppend_ -val magic_stringLength = magic Ustring.stringLength_ -val magic_fromCharCode = magic Ustring.fromCharCode_ -val magic_charCodeAt = magic Ustring.charCodeAt_ -val magic_fnLength = magic Ustring.fnLength_ -val magic_genSend = magic Ustring.genSend_ -val magic_genThrow = magic Ustring.genThrow_ -val magic_genClose = magic Ustring.genClose_ -val magic_apply = magic Ustring.apply_ - -val magic_toPrimitive = magic Ustring.toPrimitive_ -val magic_isPrimitive = magic Ustring.isPrimitive_ -val magic_defaultValue = magic Ustring.defaultValue_ -val magic_setPropertyIsEnumerable = magic Ustring.setPropertyIsEnumerable_ -val magic_getPropertyIsRemovable = magic Ustring.getPropertyIsRemovable_ -val magic_getPropertyIsEnumerable = magic Ustring.getPropertyIsEnumerable_ -val magic_hasOwnProperty = magic Ustring.hasOwnProperty_ -val magic_getPrototype = magic Ustring.getPrototype_ -val magic_getSuperClass = magic Ustring.getSuperClass_ -val magic_getSuperInterface = magic Ustring.getSuperInterface_ -val magic_getImplementedInterface = magic Ustring.getImplementedInterface_ -val magic_getEnumerableIds = magic Ustring.getEnumerableIds_ -val magic_getClassOfObject = magic Ustring.getClassOfObject_ -val magic_getClassName = magic Ustring.getClassName_ -val magic_construct = magic Ustring.construct_ +val informative_stringAppend = informative Ustring.stringAppend_ +val informative_stringLength = informative Ustring.stringLength_ +val informative_fromCharCode = informative Ustring.fromCharCode_ +val informative_charCodeAt = informative Ustring.charCodeAt_ + +val helper_fnLength = helper Ustring.fnLength_ +val helper_genSend = helper Ustring.genSend_ +val helper_genThrow = helper Ustring.genThrow_ +val helper_genClose = helper Ustring.genClose_ +val helper_apply = helper Ustring.apply_ + +val helper_toPrimitive = helper Ustring.toPrimitive_ +val helper_isPrimitive = helper Ustring.isPrimitive_ +val helper_defaultValue = helper Ustring.defaultValue_ +val helper_setPropertyIsEnumerable = helper Ustring.setPropertyIsEnumerable_ +val helper_getPropertyIsRemovable = helper Ustring.getPropertyIsRemovable_ +val helper_getPropertyIsEnumerable = helper Ustring.getPropertyIsEnumerable_ +val helper_hasOwnProperty = helper Ustring.hasOwnProperty_ +val helper_getPrototype = helper Ustring.getPrototype_ +val helper_getSuperClass = helper Ustring.getSuperClass_ +val helper_getSuperInterface = helper Ustring.getSuperInterface_ +val helper_getImplementedInterface = helper Ustring.getImplementedInterface_ +val helper_getEnumerableIds = helper Ustring.getEnumerableIds_ +val helper_getClassOfObject = helper Ustring.getClassOfObject_ +val informative_getClassName = informative Ustring.getClassName_ +val helper_construct = helper Ustring.construct_ (* * Property names that have special meanings to the interpreter. @@ -295,20 +295,16 @@ val arguments = public Ustring.arguments_ val empty = public Ustring.empty (* These are the property names that are opaque namespaces themselves are bound under. *) -val public_ES4_ = public Ustring.ES4_ - -val ES4_public_ = ES4 Ustring.public_ -val ES4_meta_ = ES4 Ustring.meta_ -val ES4_magic_ = ES4 Ustring.magic_ -val ES4_intrinsic_ = ES4 Ustring.intrinsic_ -val ES4_iterator_ = ES4 Ustring.iterator_ - -val ES4_ECMAScript4_Internal_ = ES4 Ustring.ECMAScript4_Internal_ - -val ECMAScript4_Internal_informative_ = ECMAScript4_Internal Ustring.informative_ -val ECMAScript4_Internal_helper_ = ECMAScript4_Internal Ustring.helper_ -val ECMAScript4_Internal_Unicode_ = ECMAScript4_Internal Ustring.Unicode_ -val ECMAScript4_Internal_RegExpInternals_ = ECMAScript4_Internal Ustring.RegExpInternals_ +val public_ES4 = public Ustring.ES4_ + +val ES4_public = ES4 Ustring.public_ +val ES4_meta = ES4 Ustring.meta_ +val ES4_helper = ES4 Ustring.helper_ +val ES4_intrinsic = ES4 Ustring.intrinsic_ +val ES4_iterator = ES4 Ustring.iterator_ +val ES4_informative = ES4 Ustring.informative_ +val ES4_Unicode = ES4 Ustring.Unicode_ +val ES4_RegExpInternals = ES4 Ustring.RegExpInternals_ val helper_GeneratorImpl = helper Ustring.GeneratorImpl_ diff --git a/native.sml b/native.sml index c14e4e71..758a0b9c 100644 --- a/native.sml +++ b/native.sml @@ -146,7 +146,7 @@ fun propQuery (regs:Mach.REGS) * protocol for it (and its base classes, initializers, settings, * ctors). Return the resulting instance, always an Object! * - * magic native function construct(cls:Class!, args:[*]) : Object!; + * helper native function construct(cls:Class!, args:[*]) : Object!; *) fun construct (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -162,7 +162,7 @@ fun construct (regs:Mach.REGS) (* * Retrieve the [[Class]] property of o * - * magic native function getClassName(o : Object!) : string; + * informative native function getClassName(o : Object!) : string; *) fun getClassName (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -178,7 +178,7 @@ fun getClassName (regs:Mach.REGS) * Meta-object interface: * Retrieve the class of an object instance. * - * magic native function getClassOfObject(o: Object!) : Class; + * helper native function getClassOfObject(o: Object!) : Class; *) fun getClassOfObject (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -194,7 +194,7 @@ fun getClassOfObject (regs:Mach.REGS) * Meta-object interface: * Retrieve the possibly null base class of cls. * - * magic native function getSuperClass(cls : Class!) : Class; + * helper native function getSuperClass(cls : Class!) : Class; *) fun getSuperClass (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -216,7 +216,7 @@ fun getSuperClass (regs:Mach.REGS) * Meta-object interface: * Retrieve the possibly null kth implemented interface of cls. * - * magic native function getClassExtends(cls : Class!, k: uint) : Class; + * helper native function getClassExtends(cls : Class!, k: uint) : Class; *) fun getImplementedInterface (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -241,7 +241,7 @@ fun getImplementedInterface (regs:Mach.REGS) * Meta-object interface: * Retrieve the possibly null kth base interface of iface. * - * magic native function getSuperInterface(iface: Interface!, k: uint): Interface; + * helper native function getSuperInterface(iface: Interface!, k: uint): Interface; *) fun getSuperInterface (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -265,7 +265,7 @@ fun getSuperInterface (regs:Mach.REGS) (* * Retrieve the array of enumerable properties of o, in property creation order. * - * magic native function getEnumerableIds(o : Object) : iterator::EnumerableIdArray; + * helper native function getEnumerableIds(o : Object) : iterator::EnumerableIdArray; *) fun getEnumerableIds (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -304,7 +304,7 @@ fun getEnumerableIds (regs:Mach.REGS) (* * Retrieve the possibly null [[Prototype]] property of o * - * magic native function getPrototype(o : Object!) : Object; + * helper native function getPrototype(o : Object!) : Object; *) fun getPrototype (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -319,7 +319,7 @@ fun getPrototype (regs:Mach.REGS) (* * Return true iff o has a local property named by p. * - * magic native function hasOwnProperty(o : Object!, p : string) : Boolean; + * helper native function hasOwnProperty(o : Object!, p : string) : Boolean; *) fun hasOwnProperty (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -331,7 +331,7 @@ fun hasOwnProperty (regs:Mach.REGS) * Return true if the property p does exists locally on o and its * Enumerable bit is set * - * magic native function getPropertyIsEnumerable(o : Object!, p : string) : Boolean; + * helper native function getPropertyIsEnumerable(o : Object!, p : string) : Boolean; *) fun getPropertyIsEnumerable (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -350,7 +350,7 @@ fun getPropertyIsEnumerable (regs:Mach.REGS) * Return true if the property p does exists locally on o and its * removable bit is set * - * magic native function getPropertyIsRemovable(o : Object!, p : string) : Boolean; + * helper native function getPropertyIsRemovable(o : Object!, p : string) : Boolean; *) fun getPropertyIsRemovable (regs:Mach.REGS) @@ -370,7 +370,7 @@ fun getPropertyIsRemovable (regs:Mach.REGS) * flag according to f. If the property p does not exist locally on * o, it does nothing. * - * magic native function setPropertyIsEnumerable(o : Object!, p : string, f : Boolean) : void; + * helper native function setPropertyIsEnumerable(o : Object!, p : string, f : Boolean) : void; *) fun setPropertyIsEnumerable (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -416,7 +416,7 @@ fun defaultValue (regs:Mach.REGS) * Given a function object, a this object, and an array of argument * values, call the function with the this object and arguments. * - * magic native function apply(fn : Function!, t : Object!, args : Array) : *; + * helper native function apply(fn : Function!, t : Object!, args : Array) : *; *) fun apply (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -486,7 +486,7 @@ fun genClose (regs:Mach.REGS) * numeric value of the character at that position in the * string. * - * magic native function charCodeAt(s : string, pos : uint) : uint; + * informative native function charCodeAt(s : string, pos : uint) : uint; *) fun charCodeAt (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -506,7 +506,7 @@ fun charCodeAt (regs:Mach.REGS) * Given a numeric character value, return a string of length 1 * whose element 0 is the character with that same value. * - * magic native function fromCharCode(ch : uint) : string; + * informative native function fromCharCode(ch : uint) : string; *) fun fromCharCode (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -526,7 +526,7 @@ fun fromCharCode (regs:Mach.REGS) * Given a string object, return the number of characters in the * string. * - * magic native function stringLength(s : string) : uint; + * informative native function stringLength(s : string) : uint; *) fun stringLength (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -543,7 +543,7 @@ fun stringLength (regs:Mach.REGS) * containing the characters from A followed by the characters * from B. * - * magic native function stringAppend(a : string, b : string) : string; + * informative native function stringAppend(a : string, b : string) : string; *) fun stringAppend (regs:Mach.REGS) (vals:Mach.VALUE list) @@ -1030,33 +1030,33 @@ fun registerNatives _ = fun addFn (len:int) (name:Ast.NAME) f = Mach.registerNativeFunction name {length=len, func=f} in - addFn 2 Name.magic_construct construct; - addFn 1 Name.magic_getClassName getClassName; - addFn 1 Name.magic_getClassOfObject getClassOfObject; - addFn 1 Name.magic_getSuperClass getSuperClass; - addFn 2 Name.magic_getImplementedInterface getImplementedInterface; - addFn 2 Name.magic_getSuperInterface getSuperInterface; - addFn 1 Name.magic_getEnumerableIds getEnumerableIds; - addFn 1 Name.magic_getPrototype getPrototype; - addFn 2 Name.magic_hasOwnProperty hasOwnProperty; - addFn 2 Name.magic_getPropertyIsEnumerable getPropertyIsEnumerable; - addFn 2 Name.magic_getPropertyIsRemovable getPropertyIsRemovable; - addFn 3 Name.magic_setPropertyIsEnumerable setPropertyIsEnumerable; - - addFn 2 Name.magic_toPrimitive toPrimitive; - addFn 1 Name.magic_isPrimitive isPrimitive; - addFn 2 Name.magic_defaultValue defaultValue; - - addFn 3 Name.magic_apply apply; - addFn 1 Name.magic_fnLength fnLength; - addFn 2 Name.magic_genSend genSend; - addFn 2 Name.magic_genThrow genThrow; - addFn 1 Name.magic_genClose genClose; - - addFn 2 Name.magic_charCodeAt charCodeAt; - addFn 1 Name.magic_fromCharCode fromCharCode; - addFn 1 Name.magic_stringLength stringLength; - addFn 2 Name.magic_stringAppend stringAppend; + addFn 2 Name.helper_construct construct; + addFn 1 Name.informative_getClassName getClassName; + addFn 1 Name.helper_getClassOfObject getClassOfObject; + addFn 1 Name.helper_getSuperClass getSuperClass; + addFn 2 Name.helper_getImplementedInterface getImplementedInterface; + addFn 2 Name.helper_getSuperInterface getSuperInterface; + addFn 1 Name.helper_getEnumerableIds getEnumerableIds; + addFn 1 Name.helper_getPrototype getPrototype; + addFn 2 Name.helper_hasOwnProperty hasOwnProperty; + addFn 2 Name.helper_getPropertyIsEnumerable getPropertyIsEnumerable; + addFn 2 Name.helper_getPropertyIsRemovable getPropertyIsRemovable; + addFn 3 Name.helper_setPropertyIsEnumerable setPropertyIsEnumerable; + + addFn 2 Name.helper_toPrimitive toPrimitive; + addFn 1 Name.helper_isPrimitive isPrimitive; + addFn 2 Name.helper_defaultValue defaultValue; + + addFn 3 Name.helper_apply apply; + addFn 1 Name.helper_fnLength fnLength; + addFn 2 Name.helper_genSend genSend; + addFn 2 Name.helper_genThrow genThrow; + addFn 1 Name.helper_genClose genClose; + + addFn 2 Name.informative_charCodeAt charCodeAt; + addFn 1 Name.informative_fromCharCode fromCharCode; + addFn 1 Name.informative_stringLength stringLength; + addFn 2 Name.informative_stringAppend stringAppend; addFn 1 Name.intrinsic_eval eval; addFn 1 Name.intrinsic_parseFloat parseFloat; diff --git a/unicode/casemapping.as b/unicode/casemapping.as index 48dd10d3..3ca736fb 100644 --- a/unicode/casemapping.as +++ b/unicode/casemapping.as @@ -110,7 +110,7 @@ package } print("/* Generated by ../unicode/casemapping.as */"); - print(" use namespace ECMAScript4_Internal;"); + print(" use namespace helper;"); print(" use default namespace Unicode;"); print(" var upperTbl = [];"); print(" var lowerTbl = [];");