Skip to content

Commit 5bf3218

Browse files
author
hector.espeso
committed
Added commens for ValueNode.CleanTypeClassPaths.
1 parent ab1dcf9 commit 5bf3218

File tree

1 file changed

+18
-2
lines changed
  • External/Plugins/FlashDebugger/Controls/DataTree

1 file changed

+18
-2
lines changed

External/Plugins/FlashDebugger/Controls/DataTree/ValueNode.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public ValueNode(string text, Value value)
249249
m_Value = value;
250250
}
251251

252-
private string Escape(string text)
252+
internal static string Escape(string text)
253253
{
254254
text = text.Replace("\\", "\\\\");
255255
text = text.Replace("\"", "\\\"");
@@ -266,12 +266,28 @@ private string Escape(string text)
266266
return text;
267267
}
268268

269-
private string CleanTypeClassPaths(string qualifiedName)
269+
/// <summary>
270+
/// Removes the class path from a fully qualified name. Eg.: flash.display::Sprite becomes Sprite
271+
/// </summary>
272+
/// <param name="qualifiedName">The fully qualified name to clean</param>
273+
/// <returns>The class name with no class path</returns>
274+
internal static string CleanTypeClassPaths(string qualifiedName)
270275
{
271276
char[] delims = { ',', ' ', '<', '>' };
272277
var buffer = new StringBuilder();
273278
bool inPackage = false;
274279

280+
/**
281+
In order to strip the class-path we are going to traverse the class type in
282+
reverse so we don't need to keep extra buffers or use complex splitting or regexes.
283+
Packages are always separated by colons or dots, so the first time we found one we
284+
are on the package (watch out with Vector.<> notation), and the whole type is always
285+
together, so any delim means that we finished with the type, and since this comes
286+
from the debugger we know that we are not going to find any other type delimiter,
287+
or incomplete/wrong case. We could check for Char.IsWhiteSpace for other uses.
288+
In resume, with this method we could support without much problem even complex cases like:
289+
Collections.Generic.Dictionary<Collections.Generic.Dictionary<String, Test.CustomClassKey>, Collections.Generic.List<Test.CustomClass>>
290+
*/
275291
for (int i = qualifiedName.Length - 1; i >= 0; i--)
276292
{
277293
char c = qualifiedName[i];

0 commit comments

Comments
 (0)