(object, config, _attributes)
| 7350 | |
| 7351 | Data = (function() { |
| 7352 | function Data(object, config, _attributes) { |
| 7353 | var _bound, _computed, _eval, _expr, _finals, addSpec, bind, change, changed, changes, constant, data, define, digest, dirty, equalors, equals, evaluate, event, expr, finals, flattened, freeform, get, getNS, j, key, len, list, makers, mapTo, name, ns, oldComputed, oldExpr, oldOrig, oldProps, originals, props, ref, ref1, set, shorthand, spec, to, touched, touches, trait, traits, unbind, unique, validate, validators, value, values; |
| 7354 | traits = config.traits, props = config.props, finals = config.finals, freeform = config.freeform; |
| 7355 | data = this; |
| 7356 | if ((object.props != null) && (object.expr != null) && (object.orig != null) && (object.computed != null) && (object.attributes != null)) { |
| 7357 | oldProps = shallowCopy(object.props); |
| 7358 | oldExpr = shallowCopy(object.expr); |
| 7359 | oldOrig = object.orig(); |
| 7360 | oldComputed = object.computed(); |
| 7361 | if ((ref = object.attributes) != null) { |
| 7362 | ref.dispose(); |
| 7363 | } |
| 7364 | } |
| 7365 | flattened = {}; |
| 7366 | originals = {}; |
| 7367 | mapTo = {}; |
| 7368 | to = function(name) { |
| 7369 | var ref1; |
| 7370 | return (ref1 = mapTo[name]) != null ? ref1 : name; |
| 7371 | }; |
| 7372 | define = function(name, alias) { |
| 7373 | if (mapTo[alias]) { |
| 7374 | throw new Error((object.toString()) + " - Duplicate property `" + alias + "`"); |
| 7375 | } |
| 7376 | return mapTo[alias] = name; |
| 7377 | }; |
| 7378 | get = function(key) { |
| 7379 | var ref1, ref2, ref3; |
| 7380 | return (ref1 = (ref2 = data[key]) != null ? ref2.value : void 0) != null ? ref1 : (ref3 = data[to(key)]) != null ? ref3.value : void 0; |
| 7381 | }; |
| 7382 | set = function(key, value, ignore, initial) { |
| 7383 | var attr, ref1, short, valid, validated; |
| 7384 | key = to(key); |
| 7385 | if ((attr = data[key]) == null) { |
| 7386 | if (!freeform) { |
| 7387 | throw new Error((object.toString()) + " - Setting unknown property `" + key + "={" + value + "}`"); |
| 7388 | } |
| 7389 | attr = data[key] = { |
| 7390 | short: key, |
| 7391 | type: null, |
| 7392 | last: null, |
| 7393 | value: null |
| 7394 | }; |
| 7395 | validators[key] = function(v) { |
| 7396 | return v; |
| 7397 | }; |
| 7398 | } |
| 7399 | if (!ignore) { |
| 7400 | if (_expr[key]) { |
| 7401 | throw new Error((object.toString()) + " - Can't set bound property `" + key + "={" + value + "}`"); |
| 7402 | } |
| 7403 | if (_computed[key]) { |
| 7404 | throw new Error((object.toString()) + " - Can't set computed property `" + key + "={" + value + "}`"); |
| 7405 | } |
| 7406 | if (_finals[key]) { |
| 7407 | throw new Error((object.toString()) + " - Can't set final property `" + key + "={" + value + "}`"); |
| 7408 | } |
| 7409 | } |
nothing calls this directly
no test coverage detected