Commit 0f999865 authored by Nicolas Biri's avatar Nicolas Biri

Promots some methods to the prototype in Class

parent 4a23e49e
......@@ -41,13 +41,13 @@ function Class(name, superClasses, attributes, references) {
const o = this
Object.defineProperties(o,
{ __jsmf__: {value: elementMeta(jsmfElement)}
, conformsTo: {value: () => conformsTo(o)}
, getAssociated: {value: getAssociated}
})
createAttributes(o, jsmfElement)
createReferences(o, jsmfElement)
_.forEach(attr, (v,k) => o[k] = v)
}
jsmfElement.prototype.conformsTo = function () { return conformsTo(this) }
jsmfElement.prototype.getAssociated = getAssociated
superClasses = superClasses || []
superClasses = superClasses instanceof Array ? superClasses : [superClasses]
Object.assign(jsmfElement, {__name: name, superClasses, attributes: {}, references: {}})
......@@ -65,9 +65,7 @@ Class.newInstance = (name, superClasses, attributes, references) => new Class(na
/** Return true if the given object is a JSMF Class.
*/
function isJSMFClass(o) {
return conformsTo(o) === Class
}
const isJSMFClass = o => conformsTo(o) === Class
function getInheritanceChain() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment