Clarify purpose of data validation variables.
This value doesn't actually contain default values, but instead helps verify that the correct fields are present and have the correct types. It also doesn't need to show up in code completion.
This commit is contained in:
@@ -11,7 +11,8 @@ abstract ApplicationData({
|
||||
@:optional var url:String;
|
||||
}) from Dynamic
|
||||
{
|
||||
public static var defaults = {
|
||||
@:noCompletion
|
||||
public static var expectedFields:ApplicationData = {
|
||||
file: "",
|
||||
init: "",
|
||||
main: "",
|
||||
|
||||
@@ -12,7 +12,8 @@ abstract MetaData({
|
||||
@:optional var version:String;
|
||||
}) from Dynamic
|
||||
{
|
||||
public static var defaults = {
|
||||
@:noCompletion
|
||||
public static var expectedFields:MetaData = {
|
||||
buildNumber: "",
|
||||
company: "",
|
||||
companyId: "",
|
||||
|
||||
@@ -439,11 +439,11 @@ class ProjectXMLParser extends HXProject
|
||||
name = "packageName";
|
||||
}
|
||||
|
||||
if (Reflect.hasField(ApplicationData.defaults, name))
|
||||
if (Reflect.hasField(ApplicationData.expectedFields, name))
|
||||
{
|
||||
Reflect.setField(app, name, value);
|
||||
}
|
||||
else if (Reflect.hasField(MetaData.defaults, name))
|
||||
else if (Reflect.hasField(MetaData.expectedFields, name))
|
||||
{
|
||||
Reflect.setField(meta, name, value);
|
||||
}
|
||||
@@ -856,7 +856,7 @@ class ProjectXMLParser extends HXProject
|
||||
name = "packageName";
|
||||
}
|
||||
|
||||
if (Reflect.hasField(MetaData.defaults, name))
|
||||
if (Reflect.hasField(MetaData.expectedFields, name))
|
||||
{
|
||||
Reflect.setField(meta, name, value);
|
||||
}
|
||||
@@ -2006,11 +2006,11 @@ class ProjectXMLParser extends HXProject
|
||||
Reflect.setField(windows[id], "colorDepth", Std.parseInt(value));
|
||||
|
||||
default:
|
||||
if (Reflect.hasField(WindowData.defaults, name))
|
||||
if (Reflect.hasField(WindowData.expectedFields, name))
|
||||
{
|
||||
Reflect.setField(windows[id], name, value == "true");
|
||||
}
|
||||
else if (Reflect.hasField(WindowData.defaults, formatAttributeName(name)))
|
||||
else if (Reflect.hasField(WindowData.expectedFields, formatAttributeName(name)))
|
||||
{
|
||||
Reflect.setField(windows[id], formatAttributeName(name), value == "true");
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ abstract WindowData({
|
||||
@:optional var hidden:Bool;
|
||||
}) from Dynamic
|
||||
{
|
||||
public static var defaults = {
|
||||
@:noCompletion
|
||||
public static var expectedFields:WindowData = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
x: 0.0,
|
||||
|
||||
@@ -1860,9 +1860,9 @@ class CommandLineTools
|
||||
var fieldValue = Reflect.field(project, field);
|
||||
var typeValue:Dynamic = switch (field)
|
||||
{
|
||||
case "app": ApplicationData.defaults;
|
||||
case "meta": MetaData.defaults;
|
||||
case "window": WindowData.defaults;
|
||||
case "app": ApplicationData.expectedFields;
|
||||
case "meta": MetaData.expectedFields;
|
||||
case "window": WindowData.expectedFields;
|
||||
default: fieldValue;
|
||||
};
|
||||
|
||||
@@ -2130,9 +2130,9 @@ class CommandLineTools
|
||||
var fieldReference = Reflect.field(overrides, fieldName);
|
||||
var typeValue:Dynamic = switch (fieldName)
|
||||
{
|
||||
case "app": ApplicationData.defaults;
|
||||
case "meta": MetaData.defaults;
|
||||
case "window": WindowData.defaults;
|
||||
case "app": ApplicationData.expectedFields;
|
||||
case "meta": MetaData.expectedFields;
|
||||
case "window": WindowData.expectedFields;
|
||||
default: fieldReference;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user