Commit 332c226f authored by miloyip's avatar miloyip

Remove Schema::Property::typeless member variable

parent 4335a622
...@@ -382,6 +382,7 @@ public: ...@@ -382,6 +382,7 @@ public:
for (SizeType i = 0; i < propertyCount_; i++) { for (SizeType i = 0; i < propertyCount_; i++) {
new (&properties_[i]) Property(); new (&properties_[i]) Property();
properties_[i].name = allProperties[i]; properties_[i].name = allProperties[i];
properties_[i].schema = GetTypeless();
} }
} }
} }
...@@ -390,10 +391,8 @@ public: ...@@ -390,10 +391,8 @@ public:
PointerType q = p.Append("properties"); PointerType q = p.Append("properties");
for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr) { for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr) {
SizeType index; SizeType index;
if (FindPropertyIndex(itr->name, &index)) { if (FindPropertyIndex(itr->name, &index))
document->CreateSchema(&properties_[index].schema, q.Append(itr->name), itr->value); document->CreateSchema(&properties_[index].schema, q.Append(itr->name), itr->value);
properties_[index].typeless = false;
}
} }
} }
...@@ -717,14 +716,13 @@ public: ...@@ -717,14 +716,13 @@ public:
SizeType index; SizeType index;
if (FindPropertyIndex(str, len, &index)) { if (FindPropertyIndex(str, len, &index)) {
const SchemaType* propertySchema = properties_[index].typeless ? GetTypeless() : properties_[index].schema;
if (context.patternPropertiesSchemaCount > 0) { if (context.patternPropertiesSchemaCount > 0) {
context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = propertySchema; context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = properties_[index].schema;
context.valueSchema = GetTypeless(); context.valueSchema = GetTypeless();
context.valuePatternValidatorType = Context::kPatternValidatorWithProperty; context.valuePatternValidatorType = Context::kPatternValidatorWithProperty;
} }
else else
context.valueSchema = propertySchema; context.valueSchema = properties_[index].schema;
if (properties_[index].required) if (properties_[index].required)
context.objectRequiredCount++; context.objectRequiredCount++;
...@@ -1059,14 +1057,13 @@ private: ...@@ -1059,14 +1057,13 @@ private:
} }
struct Property { struct Property {
Property() : schema(), dependenciesSchema(), dependencies(), required(false), typeless(true) {} Property() : schema(), dependenciesSchema(), dependencies(), required(false) {}
~Property() { AllocatorType::Free(dependencies); } ~Property() { AllocatorType::Free(dependencies); }
SValue name; SValue name;
const SchemaType* schema; const SchemaType* schema;
const SchemaType* dependenciesSchema; const SchemaType* dependenciesSchema;
bool* dependencies; bool* dependencies;
bool required; bool required;
bool typeless;
}; };
struct PatternProperty { struct PatternProperty {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment