Skip to content

Commit 465e77e

Browse files
Burak Emiradriaanm
Burak Emir
authored andcommitted
removed generation of unnecessary cast in match...
removed generation of unnecessary cast in matcher + little userfriendly argument check in xml library
1 parent 88c955f commit 465e77e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/library/scala/xml/Null.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
package scala.xml
1313

14+
import Predef.IllegalArgumentException
1415
import compat.StringBuilder
1516

1617
case object Null extends MetaData {
@@ -55,7 +56,11 @@ case object Null extends MetaData {
5556
def next = null
5657

5758
/** null */
58-
def apply(key: String) = null
59+
def apply(key: String) = {
60+
if(!Parsing.isNameStart (key charAt 0))
61+
throw new IllegalArgumentException("not a valid attribute name '"+key+"', so can never match !")
62+
null
63+
}
5964

6065
/** gets value of qualified (prefixed) attribute with given key */
6166
def apply(namespace: String, scope: NamespaceBinding, key: String) = null

0 commit comments

Comments
 (0)