public static CountArrayDimensions ( Symbol s ) : int | ||
s | Symbol | |
return | int |
public static int CountArrayDimensions(Symbol s)
{
if (s.Name.Length >= 3 && s.Name.StartsWith("#[") && s.Name[s.Name.Length-1] == ']') {
for (int i = 2; i < s.Name.Length-1; i++)
if (s.Name[i] != ',')
return 0;
return s.Name.Length-2;
}
return 0;
}
/// <summary>Gets the Symbol for an array with the specified number of
int CountDimensionsIfArrayType(LNode type) { LNode dimsNode; if (type.Calls(S.Of, 2) && (dimsNode = type.Args[0]).IsId) { return(S.CountArrayDimensions(dimsNode.Name)); } return(0); }