Skip to content

Commit 75a2ade

Browse files
committed
Make some fixes to ClrTypeSpec2. Add parsing tests for ClrTypeSpec2.
1 parent 9bbde99 commit 75a2ade

File tree

4 files changed

+580
-28
lines changed

4 files changed

+580
-28
lines changed

Clojure/Clojure/Lib/ClrTypeSpec2.cs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,6 @@ void SetGenericArgumentCount(int count)
498498

499499
void MergeNested(ClrTypeSpec nestedSpec)
500500
{
501-
// append any generic arguments to the current type
502-
if (nestedSpec._genericParams != null)
503-
{
504-
if (_genericParams == null)
505-
_genericParams = new List<ClrTypeSpec>();
506-
_genericParams.AddRange(nestedSpec._genericParams);
507-
}
508501

509502
// Append all nested names to the current type
510503
if (_nested == null)
@@ -515,6 +508,29 @@ void MergeNested(ClrTypeSpec nestedSpec)
515508
{
516509
_nested.AddRange(nestedSpec._nested);
517510
}
511+
512+
// append any generic arguments to the current type
513+
if (nestedSpec._genericParams != null)
514+
{
515+
if (_genericParams == null)
516+
_genericParams = new List<ClrTypeSpec>();
517+
_genericParams.AddRange(nestedSpec._genericParams);
518+
}
519+
// append any modifiers to the current type
520+
if (nestedSpec._modifierSpec != null)
521+
{
522+
if (_modifierSpec == null)
523+
_modifierSpec = new List<IClrModifierSpec>();
524+
_modifierSpec.AddRange(nestedSpec._modifierSpec);
525+
}
526+
527+
// byref flag
528+
if (nestedSpec._isByRef)
529+
{
530+
if (_isByRef)
531+
throw new ArgumentException("Can't have a byref of a byref", "typeName");
532+
_isByRef = true;
533+
}
518534
}
519535

520536

@@ -718,8 +734,8 @@ static ClrTypeSpec Parse(string name, ref int p, bool is_recurse, bool allow_aqn
718734
{
719735
// We have a nested type after a generic argument list. (Extension to the original syntax.)
720736
// Recursively parse to pick up the remainder, then merge the results.
721-
++pos; //skip '+'
722-
var nested = Parse(name, ref pos, true, false, false);
737+
pos += 2; // skip "]+" to the start of the nested name
738+
var nested = Parse(name, ref pos, true, false, true);
723739
data.MergeNested(nested);
724740
}
725741
}

Clojure/Csharp.Tests/TypeNameTests/TypeNameParsingTests.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,6 @@ public TypeSpecComparer SetIsByRef()
125125
[TestFixture]
126126
public class TypeNameParsingTests
127127
{
128-
//static Namespace _ns;
129-
130-
[OneTimeSetUp]
131-
public void Setup()
132-
{
133-
//RT.Init();
134-
135-
//_ns = Namespace.findOrCreate(Symbol.intern("Csharp.Tests"));
136-
137-
//_ns.importClass(Symbol.intern("TTypeA"), typeof(TypeA));
138-
//_ns.importClass(Symbol.intern("TOneG"), typeof(OneG<>));
139-
//_ns.importClass(Symbol.intern("TTwoG"), typeof(TwoG<,>));
140-
//_ns.importClass(Symbol.intern("TGenParent"), typeof(GenParent<,>));
141-
142-
//RT.CurrentNSVar.bindRoot(_ns);
143-
}
144-
145-
146128
[TestCase("A", "A", "#1")]
147129
[TestCase("A.B", "A.B", "#2")]
148130
[TestCase("A\\+B", "A\\+B", "#3")]

0 commit comments

Comments
 (0)