Created
April 7, 2010 08:43
-
-
Save hns/358670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/ringojs/wrappers/Storable.java b/src/org/ringojs/wrappers/Storable.java | |
index 2ee3055..302fa40 100644 | |
--- a/src/org/ringojs/wrappers/Storable.java | |
+++ b/src/org/ringojs/wrappers/Storable.java | |
@@ -70,7 +70,7 @@ public class Storable extends ScriptableObject { | |
} | |
@JSStaticFunction | |
- public static Scriptable defineClass(Scriptable store, String type) | |
+ public static Scriptable defineClass(Scriptable store, String type, Object mapping) | |
throws NoSuchMethodException { | |
int attr = DONTENUM | PERMANENT | READONLY; | |
Scriptable scope = ScriptRuntime.getTopCallScope(Context.getCurrentContext()); | |
@@ -80,6 +80,9 @@ public class Storable extends ScriptableObject { | |
// create the constructor, visible to the application | |
BaseFunction ctor = new FactoryFunction(prototype, scope, FactoryType.CONSTRUCTOR); | |
ctor.setImmunePrototypeProperty(prototype); | |
+ if (mapping != Undefined.instance) { | |
+ ctor.defineProperty("mapping", mapping, attr); | |
+ } | |
prototype.setParentScope(ctor); | |
defineProperty(prototype, "constructor", ctor, attr); | |
// create the factory function, visible to the store implementation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment