private void buildConstant(JSONObject obj, Map<String, PhaserType> typeMap) {
		if (obj.getString("kind").equals("constant")) {
			String name = obj.getString("name");
			String desc = obj.optString("description", "");
			Object defaultValue = obj.opt("defaultvalue");
			String[] types;
			if (obj.has("type")) {
				JSONArray jsonTypes = obj.getJSONObject("type").getJSONArray("names");
				types = getStringArray(jsonTypes);
			} else {
				// FIXME: this is the case of blendModes and scaleModes
				types = new String[] { "Object" };
			}
			PhaserConstant cons = new PhaserConstant();
			{
				// static flag
				String scope = obj.optString("scope", "");
				if (scope.equals("static")) {
					cons.setStatic(true);
				}
			}
			cons.setName(name);
			cons.setHelp(desc);
			cons.setTypes(types);
			cons.setDefaultValue(defaultValue);
			String memberof = obj.optString("memberof", null);
			if (memberof == null) {
				// global constant
				buildMeta(cons, obj);
				// FIXME: only add those Phaser.js constants
				if (cons.getFile().getFileName().toString().equals("Phaser.js")) {
					_globalConstants.add(cons);
				} else {
					out.println(obj.toString(2));
					throw new IllegalArgumentException("All global constants should come from Phaser.js and not from "
							+ cons.getFile().getFileName() + "#" + cons.getName());
				}
			} else {
				PhaserType type = typeMap.get(memberof);
				if (!type.getMemberMap().containsKey(name)) {
					type.getMemberMap().put(name, cons);
					cons.setDeclType(type);
					buildMeta(cons, obj);
				}
			}
		}
	}
private void buildConstant(JSONObject obj, Map<String, PhaserType> typeMap) {
		if (obj.getString("kind").equals("constant")) {
			String name = obj.getString("name");
			String desc = obj.optString("description", "");
			Object defaultValue = obj.opt("defaultvalue");
			String[] types;
			if (obj.has("type")) {
				JSONArray jsonTypes = obj.getJSONObject("type").getJSONArray("names");
				types = getStringArray(jsonTypes);
			} else {
			
				types = new String[] { "Object" };
			}
			PhaserConstant cons = new PhaserConstant();
			{
			
				String scope = obj.optString("scope", "");
				if (scope.equals("static")) {
					cons.setStatic(true);
				}
			}
			cons.setName(name);
			cons.setHelp(desc);
			cons.setTypes(types);
			cons.setDefaultValue(defaultValue);
			String memberof = obj.optString("memberof", null);
			if (memberof == null) {
			
				buildMeta(cons, obj);
			
				if (cons.getFile().getFileName().toString().equals("Phaser.js")) {
					_globalConstants.add(cons);
				} else {
					out.println(obj.toString(2));
					throw new IllegalArgumentException("All global constants should come from Phaser.js and not from "
							+ cons.getFile().getFileName() + "#" + cons.getName());
				}
			} else {
				PhaserType type = typeMap.get(memberof);
				if (!type.getMemberMap().containsKey(name)) {
					type.getMemberMap().put(name, cons);
					cons.setDeclType(type);
					buildMeta(cons, obj);
				}
			}
		}
	}
private void buildconstant(jsonobject obj, map<string, phasertype> typemap) { if (obj.getstring("kind").equals("constant")) { string name = obj.getstring("name"); string desc = obj.optstring("description", ""); object defaultvalue = obj.opt("defaultvalue"); string[] types; if (obj.has("type")) { jsonarray jsontypes = obj.getjsonobject("type").getjsonarray("names"); types = getstringarray(jsontypes); } else { types = new string[] { "object" }; } phaserconstant cons = new phaserconstant(); { string scope = obj.optstring("scope", ""); if (scope.equals("static")) { cons.setstatic(true); } } cons.setname(name); cons.sethelp(desc); cons.settypes(types); cons.setdefaultvalue(defaultvalue); string memberof = obj.optstring("memberof", null); if (memberof == null) { buildmeta(cons, obj); if (cons.getfile().getfilename().tostring().equals("phaser.js")) { _globalconstants.add(cons); } else { out.println(obj.tostring(2)); throw new illegalargumentexception("all global constants should come from phaser.js and not from " + cons.getfile().getfilename() + "#" + cons.getname()); } } else { phasertype type = typemap.get(memberof); if (!type.getmembermap().containskey(name)) { type.getmembermap().put(name, cons); cons.setdecltype(type); buildmeta(cons, obj); } } } }