@@ -62,14 +62,15 @@ abstract class SymbolicXMLBuilder(@unused p: Parsers#Parser, @unused preserveWS:
62
62
val _scope : NameType = nameType(" $scope" )
63
63
val _tmpscope : NameType = nameType(" $tmpscope" )
64
64
val _xml : NameType = nameType(" xml" )
65
+ val _toVector = nameType(" toVector" )
65
66
}
66
67
67
68
import xmltypes .{
68
69
_Comment , _Elem , _EntityRef , _Group , _MetaData , _NamespaceBinding , _NodeBuffer ,
69
70
_PCData , _PrefixedAttribute , _ProcInstr , _Text , _Unparsed , _UnprefixedAttribute
70
71
}
71
72
72
- import xmlterms .{ _Null , __Elem , __Text , _buf , _md , _plus , _scope , _tmpscope , _xml }
73
+ import xmlterms .{ _Null , __Elem , __Text , _buf , _md , _plus , _scope , _tmpscope , _xml , _toVector }
73
74
74
75
/** Attachment for trees deriving from text nodes (Text, CData, entities). Used for coalescing. */
75
76
case class TextAttache (pos : Position , text : String )
@@ -111,7 +112,7 @@ abstract class SymbolicXMLBuilder(@unused p: Parsers#Parser, @unused preserveWS:
111
112
{
112
113
def starArgs =
113
114
if (children.isEmpty) Nil
114
- else List (Typed (makeXMLseq(pos, children), wildStar))
115
+ else List (Typed (makeXMLseq(pos, children, toVector = true ), wildStar))
115
116
116
117
def pat = Apply (_scala_xml__Elem, List (pre, label, wild, wild) ::: convertToTextPat(children))
117
118
def nonpat = New (_scala_xml_Elem, List (List (pre, label, attrs, scope, if (empty) Literal (Constant (true )) else Literal (Constant (false ))) ::: starArgs))
@@ -166,7 +167,7 @@ abstract class SymbolicXMLBuilder(@unused p: Parsers#Parser, @unused preserveWS:
166
167
parseAttributeValue(s, text(pos, _), entityRef(pos, _)) match {
167
168
case Nil => gen.mkNil
168
169
case t :: Nil => t
169
- case ts => makeXMLseq(pos, ts.toList )
170
+ case ts => makeXMLseq(pos, ts, toVector = true )
170
171
}
171
172
}
172
173
@@ -176,11 +177,12 @@ abstract class SymbolicXMLBuilder(@unused p: Parsers#Parser, @unused preserveWS:
176
177
}
177
178
178
179
/** could optimize if args.length == 0, args.length == 1 AND args(0) is <: Node. */
179
- def makeXMLseq (pos : Position , args : scala.collection.Seq [Tree ]) = {
180
+ def makeXMLseq (pos : Position , args : scala.collection.Seq [Tree ], toVector : Boolean ) = {
180
181
val buffer = atPos(pos)(ValDef (NoMods , _buf, TypeTree (), New (_scala_xml_NodeBuffer, ListOfNil )))
181
182
val applies = args.filterNot(isEmptyText).map(t => atPos(t.pos)(Apply (Select (Ident (_buf), _plus), List (t))))
182
183
183
- atPos(pos)( gen.mkBlock(buffer :: applies.toList ::: List (Ident (_buf))) )
184
+ val res = if (toVector) Select (Ident (_buf), _toVector) else Ident (_buf)
185
+ atPos(pos)( gen.mkBlock(buffer :: applies.toList ::: List (res)) )
184
186
}
185
187
186
188
/** Returns (Some(prefix) | None, rest) based on position of ':' */
@@ -191,7 +193,7 @@ abstract class SymbolicXMLBuilder(@unused p: Parsers#Parser, @unused preserveWS:
191
193
192
194
/** Various node constructions. */
193
195
def group (pos : Position , args : scala.collection.Seq [Tree ]): Tree =
194
- atPos(pos)( New (_scala_xml_Group, LL (makeXMLseq(pos, args))) )
196
+ atPos(pos)( New (_scala_xml_Group, LL (makeXMLseq(pos, args, toVector = true ))) )
195
197
196
198
def unparsed (pos : Position , str : String ): Tree =
197
199
atPos(pos)( New (_scala_xml_Unparsed, LL (const(str))) )
0 commit comments