-
Notifications
You must be signed in to change notification settings - Fork 58
[ApiXmlAdjuster] Use different data model structures for better performance #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,14 @@ public static void Load (this JavaApi api, XmlReader reader, bool isReferenceOnl | |
break; // </api> | ||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "package") | ||
throw XmlUtil.UnexpectedElementOrContent ("api", reader, "package"); | ||
var pkg = api.Packages.FirstOrDefault (p => p.Name == reader.GetAttribute ("name")); | ||
if (pkg == null) { | ||
|
||
var name = reader.GetAttribute ("name"); | ||
|
||
if (!api.Packages.TryGetValue (name, out var pkg)) { | ||
pkg = new JavaPackage (api); | ||
api.Packages.Add (pkg); | ||
api.Packages.Add (name, pkg); | ||
} | ||
|
||
pkg.Load (reader, isReferenceOnly); | ||
} while (true); | ||
|
||
|
@@ -67,11 +70,11 @@ public static void Load (this JavaPackage package, XmlReader reader, bool isRefe | |
if (reader.LocalName == "class") { | ||
var kls = new JavaClass (package) { IsReferenceOnly = isReferenceOnly }; | ||
kls.Load (reader); | ||
package.Types.Add (kls); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. …back on the "smaller diffs!" front, if we did have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested out
|
||
package.AddType (kls); | ||
} else if (reader.LocalName == "interface") { | ||
var iface = new JavaInterface (package) { IsReferenceOnly = isReferenceOnly }; | ||
iface.Load (reader); | ||
package.Types.Add (iface); | ||
package.AddType (iface); | ||
} else | ||
throw XmlUtil.UnexpectedElementOrContent ("package", reader, "class", "interface"); | ||
} while (true); | ||
|
Uh oh!
There was an error while loading. Please reload this page.