Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created November 18, 2016 16:49
Show Gist options
  • Save jerstlouis/b0b445d677dbea107174d4f617765967 to your computer and use it in GitHub Desktop.
Save jerstlouis/b0b445d677dbea107174d4f617765967 to your computer and use it in GitHub Desktop.
diff --git a/ecere/src/sys/JSON.ec b/ecere/src/sys/JSON.ec
index cc793b7..9d63b68 100644
--- a/ecere/src/sys/JSON.ec
+++ b/ecere/src/sys/JSON.ec
@@ -702,24 +702,13 @@ private:
bool isKey = false;
bool isTemplateArg = false;
uint offset = 0;
- if(eCON)
+
+ ch = 0;
+ SkipEmpty();
+
+ if(eCON && (ch != '=' && ch != ':'))
{
- SkipEmpty();
- prop = null; member = null;
- if(ch == '=' || ch == ':')
- {
- if(wasQuoted)
- string[0] = (char)tolower(string[0]);
- while(1)
- {
- eClass_FindNextMember(objectType, &curClass, &curMember, subMemberStack, &subMemberStackPos);
- if(!curMember) break;
- if(!strcmp(curMember.name, string))
- break;
- }
- }
- else
- eClass_FindNextMember(objectType, &curClass, &curMember, subMemberStack, &subMemberStackPos);
+ eClass_FindNextMember(objectType, &curClass, &curMember, subMemberStack, &subMemberStackPos);
if(curMember)
{
prop = curMember.isProperty ? (Property)curMember : null;
@@ -754,9 +743,10 @@ private:
PrintLn("Warning: default member assignment: no more members");
}
}
- if(objectType && !eCON)
+ else if(objectType)
{
- string[0] = (char)tolower(string[0]);
+ if(!eCON || wasQuoted)
+ string[0] = (char)tolower(string[0]);
if(mapKeyClass && !strcmp(string, "key"))
{
prop = eClass_FindProperty(objectType, "key", objectType.module);
@@ -772,17 +762,23 @@ private:
}
else
{
- member = eClass_FindDataMember(objectType, string, objectType.module, null, null);
+ member = eClass_FindDataMember(objectType, string, objectType.module, subMemberStack, &subMemberStackPos);
if(member)
{
type = superFindClass(member.dataTypeString, objectType.module);
offset = member._class.offset + member.offset;
+ curMember = member;
+ curClass = member._class;
}
else if(!member)
{
prop = eClass_FindProperty(objectType, string, objectType.module);
if(prop)
+ {
type = superFindClass(prop.dataTypeString, objectType.module);
+ curMember = (DataMember)prop;
+ curClass = prop._class;
+ }
else
PrintLn("Warning: member ", string, " not found in class ", (String)objectType.name);
}
@@ -816,11 +812,6 @@ private:
value.p = new0 byte[type.structSize];
}
}
- if(!eCON)
- {
- ch = 0;
- SkipEmpty();
- }
if(eCON && ch != '=' && ch != ':')
{
f.Seek(seek-1, start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment