Re-add required properties. Fixes #61.

This commit is contained in:
Tom MacWright 2011-01-25 16:44:18 -05:00
parent 00d144bc08
commit fec9ff60ac
2 changed files with 15 additions and 1 deletions

View File

@ -79,6 +79,17 @@ tree.Definition.prototype.toXML = function(env) {
sym = sym[0];
}
if (sym) {
if (reqfail = tree.Reference.requiredProperties(
sym,
this.unique_rules())) {
env.error({
message: reqfail,
index: this.unique_rules()[0] && this.unique_rules()[0].index
});
}
}
var symname = sym ? sym.charAt(0).toUpperCase()
+ sym.slice(1).replace(/\-./, function(str) {
return str[1].toUpperCase();

View File

@ -620,8 +620,11 @@ tree.Reference.requiredPropertyList = function(symbolizer_name) {
return properties;
};
tree.Reference.requiredProperties = function(symbolizer_name, properties) {
tree.Reference.requiredProperties = function(symbolizer_name, rules) {
var req = tree.Reference.requiredPropertyList(symbolizer_name);
var properties = rules.map(function(r) {
return r.name;
});
for (i in req) {
if (properties.indexOf(req[i]) === -1) {
return 'Property ' + req[i] + ' required for defining '