/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties
516448
function appendElement (hander,node) {
    if (!hander.currentElement) {
        hander.doc.appendChild(node);
    } else {
        hander.currentElement.appendChild(node);
    }
}
768822
function protectStaticProperty(name, meta, constructor) {
        constructor[cacheKeyword].properties[name] = meta.value;

        if (meta.isPrivate) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId) {
                        return constructor[cacheKeyword].properties[name];
                    }

                    throw new Error('Cannot access private static property "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: meta.isConst ?
                        function () {
                            throw new Error('Cannot change value of constant property "' + name + '" of class "' + constructor.prototype.$name + '".');
                        } :
                        function set(newVal) {
                            var currCaller = process._dejavu.caller;

                            if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId) {
                                constructor[cacheKeyword].properties[name] = newVal;
                            } else {
                                throw new Error('Cannot set private property "' + name + '" of class "' + constructor.prototype.$name + '".');
                            }
                        },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isProtected) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || constructor.prototype instanceof currCaller.constructor)) {
                        return constructor[cacheKeyword].properties[name];
                    }

                    throw new Error('Cannot access protected static property "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: meta.isConst ?
                        function () {
                            throw new Error('Cannot change value of constant property "' + name + '" of class "' + constructor.prototype.$name + '".');
                        } :
                        function set(newVal) {
                            var currCaller = process._dejavu.caller;

                            if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || constructor.prototype instanceof currCaller.constructor)) {
                                constructor[cacheKeyword].properties[name] = newVal;
                            } else {
                                throw new Error('Cannot set protected static property "' + name + '" of class "' + constructor.prototype.$name + '".');
                            }
                        },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isConst) {
            Object.defineProperty(constructor, name, {
                get: function () {
                    return constructor[cacheKeyword].properties[name];
                },
                set: function () {
                    throw new Error('Cannot change value of constant property "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                configurable: false,
                enumerable: true
            });
        }
    }
737188
function parseMembers(params, constructor, isFinal) {
        var key,
            value,
            cache = {};

        if (hasOwn(params, '$statics')) {
            for (key in params.$statics) {
                value = params.$statics[key];

                if (isFunction(value) && !value[$class] && !value[$interface]) {
                    insert(constructor[$class].staticMethods, key);
                    constructor[key] = wrapMethod(key, value, constructor, true);
                } else {
                    constructor[$class].staticProperties[key] = value;
                    constructor[key] = value;
                }
            }

            delete params.$statics;
        }

        // Save certain keywords in the cache for the loop bellow to work faster
        if (hasOwn(params, '$implements')) {
            cache.$implements = params.$implements;
            delete params.$implements;
        }

        if (hasOwn(params, '$abstracts')) {
            cache.$abstracts = params.$abstracts;
            delete params.$abstracts;
        }

        for (key in params) {
            value = params[key];

            if (isFunction(value) && !value[$class] && !value[$interface]) {
                constructor.prototype[key] = wrapMethod(key, value, constructor);

                // If the function is specified to be bound, add it to the binds
                if (value[$bound]) {
                    insert(constructor[$class].binds, key);
                    delete value[$bound];
                }

                // We should remove the key here because a class may override from primitive to non primitive,
                // but we skip it because the clone already handles it
            } else {
                constructor.prototype[key] = value;

                if (!isImmutable(value)) {
                    insert(constructor[$class].properties, key);
                }
            }
        }

        // Restore from cache
        mixIn(params, cache);
    }
720634
function internal(obj) {
  if (!privateMap.has(obj)) {
    privateMap.set(obj, {});
  }

  return privateMap.get(obj);
}
299145
def view_properties field=@form.get_current_field
    alert "Nil field" unless field
    return unless field
    text = ["Instance Variables"]
    text << "------------------"
    #iv = field.instance_variables.map do |v| v.to_s; end
    field.instance_variables.each do |v|
      val = field.instance_variable_get(v)
      klass = val.class
      if val.is_a? Array 
        val = val.size
      elsif val.is_a? Hash
        val = val.keys
      end
      case val
      when String, Integer, TrueClass, FalseClass, NilClass, Array, Hash, Symbol
        ;
      else
        val = "Not shown"
      end
      text << "%20s  %10s  %s" % [v, klass, val]
    end
    text << " "
    text << "Public Methods"
    text << "--------------"
    pm = field.public_methods(false).map do |v| v.to_s; end
    text +=  pm
    text << " "
    text << "Inherited Methods"
    text << "-----------------"
    pm = field.public_methods(true) - field.public_methods(false)
    pm = pm.map do |v| v.to_s; end
    text +=  pm

    #$log.debug "  view_properties #{s.size} , #{s} "
    textdialog text, :title => "Properties"
  end
1029306
def view_properties_as_tree field=@form.get_current_field
    alert "Nil field" unless field
    return unless field
    text = []
    tree = {}
    #iv = field.instance_variables.map do |v| v.to_s; end
    field.instance_variables.each do |v|
      val = field.instance_variable_get(v)
      klass = val.class
      if val.is_a? Array 
        #tree[v.to_s] = val
        text << { v.to_s => val }
        val = val.size
      elsif val.is_a? Hash
        #tree[v.to_s] = val
        text << { v.to_s => val }
        if val.size <= 5
          val = val.keys
        else
          val = val.keys.size.to_s + " [" + val.keys.first(5).join(", ") + " ...]"
        end
      end
      case val
      when String, Integer, TrueClass, FalseClass, NilClass, Array, Hash, Symbol
        ;
      else
        val = "Not shown"
      end
      text << "%-20s  %10s  %s" % [v, klass, val]
    end
    tree["Instance Variables"] = text
    pm = field.public_methods(false).map do |v| v.to_s; end
    tree["Public Methods"] = pm
    pm = field.public_methods(true) - field.public_methods(false)
    pm = pm.map do |v| v.to_s; end
    tree["Inherited Methods"] = pm

    #$log.debug "  view_properties #{s.size} , #{s} "
    treedialog tree, :title => "Properties"
  end
398541
function protectProperty(name, meta, instance) {
        if (meta.isPrivate) {
            if (!meta.isImmutable) {
                instance[cacheKeyword].properties[name] = deepClone(meta.value);
                instance[redefinedCacheKeyword].properties[name] = true; // This is just for the inspect
            } else {
                instance[cacheKeyword].properties[name] = meta.value;
            }

            Object.defineProperty(instance, name, {
                get: function get() {
                    var currCaller = process._dejavu.caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId)) {
                        return instance[cacheKeyword].properties[name];
                    }

                    throw new Error('Cannot access private property "' + name + '" of class "' + instance.$name + '".');
                },
                set: function set(newVal) {
                    var currCaller = process._dejavu.caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId)) {
                        instance[cacheKeyword].properties[name] = newVal;
                        instance[redefinedCacheKeyword].properties[name] = true;
                    } else {
                        throw new Error('Cannot set private property "' + name + '" of class "' + instance.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isProtected) {
            if (!meta.isImmutable) {
                instance[cacheKeyword].properties[name] = deepClone(meta.value);
                instance[redefinedCacheKeyword].properties[name] = true; // This is just for the inspect
            } else {
                instance[cacheKeyword].properties[name] = meta.value;
            }

            Object.defineProperty(instance, name, {
                get: function get() {
                    var currCaller = process._dejavu.caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || instance instanceof currCaller.constructor))) {
                        return instance[cacheKeyword].properties[name];
                    }

                    throw new Error('Cannot access protected property "' + name + '" of class "' + instance.$name + '".');
                },
                set: function set(newVal) {
                    var currCaller = process._dejavu.caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || instance instanceof currCaller.constructor))) {
                        instance[cacheKeyword].properties[name] = newVal;
                        instance[redefinedCacheKeyword].properties[name] = true;
                    } else {
                        throw new Error('Cannot set protected property "' + name + '" of class "' + instance.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else if (!meta.isImmutable) {
            instance[name] = deepClone(instance[name]);
            instance[redefinedCacheKeyword].properties[name] = true; // This is just for the inspect
        } else {
            instance[name] = meta.value;
        }
    }
1149970
function serializeRefs(k,v, clientData) {
  if (k == 'clientTemplates') {  //avoid circular refs but doesn't seem to work??
    return undefined;
  }
  if (v && typeof v === 'object') {
    //we have to do it like this to avoid toString being call internally
    var copy = new v.constructor();
    for (var prop in v) {
      if (!v.hasOwnProperty(prop)) continue;
      var val = v[prop]
      if (val && val._id) {
        var obj = val;
        clientData[obj._id] = _.extend(clientData[obj._id] || {}, obj);
        val = "@@@" + obj._id+ "@@@";
      }
      copy[prop] = val;
    }
    return copy;
  }
  return v;
}
1299145
function(object) {
		var methods = Array.prototype.slice.call(arguments).slice(1);
		if (!methods.length) {
			methods = gui.Object.ownmethods(object).filter(function(name) {
				return name[0] !== "_"; // exclude private methods
			});
		}
		methods.forEach(function(name) {
			object[name] = object[name].bind(object);
		});
		return object;
	}
20017
@Override
    public void visitCode(Code obj) {
        if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) {
            return;
        }

        Method m = getMethod();
        if (m.isSynthetic()) {
            return;
        }

        if (!interfaceMethods.contains(new QMethod(methodName, m.getSignature()))) {
            super.visitCode(obj);
        }
    }
115433
static function __static()
	{
		XmlTokenizedType::$typeToCodeMap = array(
			'xs:string'					=> XmlTokenizedType::None,
			'xs:boolean'				=> XmlTokenizedType::None,
			'xs:decimal'				=> XmlTokenizedType::None,
			'xs:double'					=> XmlTokenizedType::None,
			'xs:float'					=> XmlTokenizedType::None,
			'xs:duration'				=> XmlTokenizedType::None,
			'xs:dateTime'				=> XmlTokenizedType::None,
			'xs:time'					=> XmlTokenizedType::None,
			'xs:date'					=> XmlTokenizedType::None,
			'xs:gYearMonth'				=> XmlTokenizedType::None,
			'xs:gYear'					=> XmlTokenizedType::None,
			'xs:gMonthDay'				=> XmlTokenizedType::None,
			'xs:gDay'					=> XmlTokenizedType::None,
			'xs:gMonth'					=> XmlTokenizedType::None,
			'xs:hexBinary'				=> XmlTokenizedType::None,
			'xs:base64Binary'			=> XmlTokenizedType::None,
			'xs:anyURI'					=> XmlTokenizedType::None,
			'xs:QName'					=> XmlTokenizedType::None,
			'xs:NOTATION'				=> XmlTokenizedType::NOTATION,
			'xs:normalizedString'		=> XmlTokenizedType::None,
			'xs:token'					=> XmlTokenizedType::None,
			'xs:language'				=> XmlTokenizedType::None,
			'xs:name'					=> XmlTokenizedType::None,
			'xs:NCName'					=> XmlTokenizedType::NCName,
			'xs:NMTOKEN'				=> XmlTokenizedType::NMTOKEN,
			'xs:ID'						=> XmlTokenizedType::ID,
			'xs:IDREF'					=> XmlTokenizedType::IDREF,
			'xs:ENTITY'					=> XmlTokenizedType::ENTITY,
			'xs:integer'				=> XmlTokenizedType::None,
			'xs:nonPositiveInteger'		=> XmlTokenizedType::None,
			'xs:long'					=> XmlTokenizedType::None,
			'xs:nonNegativeInteger'		=> XmlTokenizedType::None,
			'xs:negativeInteger' 		=> XmlTokenizedType::None,
			'xs:int'					=> XmlTokenizedType::None,
			'xs:short'					=> XmlTokenizedType::None,
			'xs:byte'					=> XmlTokenizedType::None,
			'xs:positiveInteger' 		=> XmlTokenizedType::None,
			'xs:unsignedLong' 			=> XmlTokenizedType::None,
			'xs:unsignedInt' 			=> XmlTokenizedType::None,
			'xs:unsignedShort'			=> XmlTokenizedType::None,
			'xs:unsignedByte'			=> XmlTokenizedType::None,
			'xs:IDREFS'					=> XmlTokenizedType::IDREFS,
			'xs:ENTITIES'				=> XmlTokenizedType::ENTITIES,
			'xs:NMTOKENS'				=> XmlTokenizedType::NMTOKENS,
			'xsd:string'				=> XmlTokenizedType::None,
			'xsd:boolean'				=> XmlTokenizedType::None,
			'xsd:decimal'				=> XmlTokenizedType::None,
			'xsd:double'				=> XmlTokenizedType::None,
			'xsd:float'					=> XmlTokenizedType::None,
			'xsd:duration'				=> XmlTokenizedType::None,
			'xsd:dateTime'				=> XmlTokenizedType::None,
			'xsd:time'					=> XmlTokenizedType::None,
			'xsd:date'					=> XmlTokenizedType::None,
			'xsd:gYearMonth'			=> XmlTokenizedType::None,
			'xsd:gYear'					=> XmlTokenizedType::None,
			'xsd:gMonthDay'				=> XmlTokenizedType::None,
			'xsd:gDay'					=> XmlTokenizedType::None,
			'xsd:gMonth'				=> XmlTokenizedType::None,
			'xsd:hexBinary'				=> XmlTokenizedType::None,
			'xsd:base64Binary'			=> XmlTokenizedType::None,
			'xsd:anyURI'				=> XmlTokenizedType::None,
			'xsd:QName'					=> XmlTokenizedType::None,
			'xsd:NOTATION'				=> XmlTokenizedType::NOTATION,
			'xsd:normalizedString'		=> XmlTokenizedType::None,
			'xsd:token'					=> XmlTokenizedType::None,
			'xsd:language'				=> XmlTokenizedType::None,
			'xsd:name'					=> XmlTokenizedType::None,
			'xsd:NCName'				=> XmlTokenizedType::NCName,
			'xsd:NMTOKEN'				=> XmlTokenizedType::NMTOKEN,
			'xsd:ID'					=> XmlTokenizedType::ID,
			'xsd:IDREF'					=> XmlTokenizedType::IDREF,
			'xsd:ENTITY'				=> XmlTokenizedType::ENTITY,
			'xsd:integer'				=> XmlTokenizedType::None,
			'xsd:nonPositiveInteger'	=> XmlTokenizedType::None,
			'xsd:long'					=> XmlTokenizedType::None,
			'xsd:nonNegativeInteger'	=> XmlTokenizedType::None,
			'xsd:negativeInteger' 		=> XmlTokenizedType::None,
			'xsd:int'					=> XmlTokenizedType::None,
			'xsd:short'					=> XmlTokenizedType::None,
			'xsd:byte'					=> XmlTokenizedType::None,
			'xsd:positiveInteger' 		=> XmlTokenizedType::None,
			'xsd:unsignedLong' 			=> XmlTokenizedType::None,
			'xsd:unsignedInt' 			=> XmlTokenizedType::None,
			'xsd:unsignedShort'			=> XmlTokenizedType::None,
			'xsd:unsignedByte'			=> XmlTokenizedType::None,
			'xsd:IDREFS'				=> XmlTokenizedType::IDREFS,
			'xsd:ENTITIES'				=> XmlTokenizedType::ENTITIES,
			'xsd:NMTOKENS'				=> XmlTokenizedType::NMTOKENS,
		);
	}
1311059
function creareSetGet( classProto ) {
			// Storing key:value in separate variable as using original object will
			// create infinit loop.
			var valueStorage = {};
			// Static is not supported.... will not support ie < 9;
			// Adding setter and getter
			classProto.prototype.$add = function( obj, key, val, isConst ) {

				// val has a value for it's original object.
				if (val != undefined) {
					valueStorage[key] = val;
				}

				function setter( newval ) {
					if (isConst) {
						throw this + "." + key + " can not be changed.";
					}
					valueStorage[key] = newval;
				}

				function getter( ) {
					return valueStorage[key];
				}
				/// ie dont include key created by setter getter if not intialized before
				obj[key] = null;
				if (Object.defineProperty && isGetterSetterSupported) {
					Object.defineProperty(obj, key, {
					    get : getter,
					    set : setter
					});
				}
				else if (obj.__defineGetter__) {
					obj.__defineGetter__(key, getter);
					obj.__defineSetter__(key, setter);
				}
				else {
					obj[key] == undefined && (obj[key] = valueStorage[key]);
				}
			};
		}
231834
public static function __static()
    {
        self::$DOCBLOCK                     = new Docblock();
        self::$ANNOTATION                   = new InAnnotation();
        self::$ANNOTATION_NAME              = new AnnotationName();
        self::$ANNOTATION_TYPE              = new AnnotationType();
        self::$ARGUMENT                     = new AnnotationForArgument();
        self::$PARAM_NAME                   = new ParamName();
        self::$PARAM_VALUE                  = new ParamValue();
        self::$PARAM_VALUE_IN_SINGLE_QUOTES = new EnclosedParamValue();
        self::$PARAM_VALUE_IN_DOUBLE_QUOTES = new EnclosedParamValue();
        self::$DOCBLOCK->init();
        self::$ANNOTATION->init();
        self::$ANNOTATION_NAME->init();
        self::$ANNOTATION_TYPE->init();
        self::$ARGUMENT->init();
        self::$PARAM_NAME->init();
        self::$PARAM_VALUE->init();
        self::$PARAM_VALUE_IN_SINGLE_QUOTES->init("'");
        self::$PARAM_VALUE_IN_DOUBLE_QUOTES->init('"');
    }
1171111
static Property parse(final String propertyLine) throws IOException {
        if (!propertyLine.startsWith("property ")) {
            throw new IOException("not a property: '"
                    + propertyLine + "'");
        }
        String definition = propertyLine.substring("property ".length());

        if (definition.startsWith("list")) {
            return ListProperty.parse(propertyLine);
        }

        String[] parts = definition.split(" +", 2);
        if (parts.length != 2) {
            throw new IOException("Expected two parts in property definition: '"
                    + propertyLine + "'");
        }
        String type = parts[0];
        String name = parts[1];

        DataType dataType;
        try {
            dataType = DataType.parse(type);
        }
        catch (IllegalArgumentException e) {
            throw new IOException(e.getMessage());
        }

        return new Property(name, dataType);
    }
1176474
public function __findSerialisablePropertyAccessors() {

        // Grab the class name first.
        $className = get_class($this);

        // If no accessor map has been previously cached for this class type, cache it now.
        if (!isset (self::$__accessorMaps [$className])) {


            $reflectionClass = new \ReflectionClass ($className);

            // Create the accessors array for storing all possible accessors.
            $accessors = array();

            // Loop through all methods, checking for public get and set accessors first.
            $methods = $reflectionClass->getMethods();
            foreach ($methods as $method) {

                if ($method->isStatic())
                    continue;

                if ((substr($method->getName(), 0, 3) == "get") && ($method->getNumberOfRequiredParameters() == 0)) {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["get"] = $method;
                } else if (substr($method->getName(), 0, 3) == "set") {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["set"] = $method;
                }
            }

            // Now loop through all properties, checking for any public / protected ones
            $properties = $reflectionClass->getProperties();
            foreach ($properties as $property) {

                if ($property->isStatic())
                    continue;

                $propertyName = strtolower($property->getName());

                if (!isset ($accessors [$propertyName])) {
                    $accessors [$propertyName] = array();
                }
                if (!isset ($accessors [$propertyName] ["get"]))
                    $accessors [$propertyName] ["get"] = $property;
                if (!isset ($accessors [$propertyName] ["set"]))
                    $accessors [$propertyName] ["set"] = $property;

            }

            self::$__accessorMaps [$className] = $accessors;

        }

        return self::$__accessorMaps [$className];
    }
192182
function inspectConstructor(target, cache) {
        // If browser has no define property it means it is too old and
        // in that case we return the target itself.
        // This could be improved but I think it does not worth the trouble
        if (!hasDefineProperty) {
            return target;
        }

        var def,
            methodsCache,
            propertiesCache,
            membersCache,
            obj,
            tmp,
            key;

        obj = fetchCache(target, cache.constructors);
        if (obj) {
            return obj;
        }

        def = target[$class];
        obj = def.simpleConstructor;
        methodsCache = target[cacheKeyword].methods;
        propertiesCache = target[cacheKeyword].properties;

        cache.constructors.push({ target: target, inspect: obj });

        // Constructor methods
        for (key in methodsCache) {
            obj[key] = inspect(methodsCache[key], cache, true);
        }

        // Constructor properties
        for (key in propertiesCache) {
            tmp = propertiesCache[key];
            obj[key] = inspect(tmp, cache, true);
        }

        // Handle constructor undeclared properties
        methodsCache = def.methods;
        propertiesCache = def.properties;
        for (key in target) {
            if (hasOwn(target, key) && !hasOwn(obj, key) && !propertiesCache[key] && !methodsCache[key]) {
                obj[key] = inspect(target[key], cache, true);
            }
        }

        obj = obj.prototype;

        // Prototype members
        target = target.prototype;
        membersCache = def.ownMembers;
        methodsCache = def.methods;
        propertiesCache = def.properties;

        for (key in membersCache) {
            tmp = methodsCache[key] ? methodsCache[key].implementation : propertiesCache[key].value;
            obj[key] = inspect(tmp, cache, true);
        }

        // Handle undeclared prototype members
        for (key in target) {
            if (hasOwn(target, key) && !hasOwn(obj, key) && !membersCache[key]) {
                obj[key] = inspect(target[key], cache, true);
            }
        }

        return obj;
    }
279780
function instance_getters () {
        var _parseArguments = parseArguments$1(arguments),
            getters = _parseArguments.getters,
            options = _parseArguments.options;

        return Object.keys(getters).reduce(function (instanceGetters, name) {
            instanceGetters[name] = function (state, otherGetters) {
                return function (instanceKey) {
                    var instance = state[options.stateKey || 'instances'].find(function (obj) {
                        return obj[options.instanceKey || 'id'] === instanceKey;
                    });

                    if (instance) {
                        return getters[name](instance, otherGetters, state, instanceKey);
                    }
                };
            };

            return instanceGetters;
        }, {});
    }