aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-04-23 14:35:01 +0200
committerMartin Odersky <odersky@gmail.com>2013-04-23 14:35:01 +0200
commit91f71c3112a06c86aa36a9aaedf4ed159c3d8961 (patch)
tree8e00d4ffbfea7cb0220ab8ed896fbd3fb88fa332
parent7bca39c57e31da15478033ac4d581705cbeb4bc9 (diff)
downloaddotty-91f71c3112a06c86aa36a9aaedf4ed159c3d8961.tar.gz
dotty-91f71c3112a06c86aa36a9aaedf4ed159c3d8961.tar.bz2
dotty-91f71c3112a06c86aa36a9aaedf4ed159c3d8961.zip
Fixed build errors.
-rw-r--r--src/dotty/tools/dotc/core/TypedTrees.scala2
-rw-r--r--src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala130
2 files changed, 66 insertions, 66 deletions
diff --git a/src/dotty/tools/dotc/core/TypedTrees.scala b/src/dotty/tools/dotc/core/TypedTrees.scala
index bec986ea2..bfe2c957d 100644
--- a/src/dotty/tools/dotc/core/TypedTrees.scala
+++ b/src/dotty/tools/dotc/core/TypedTrees.scala
@@ -239,7 +239,7 @@ object TypedTrees {
case pre => SelectFromTypeTree(TypeTree(pre), tp)
} // no checks necessary
- def ref(sym: TermSymbol)implicit ctx: Context): tpd.NameTree = ref(sym.termRef)
+ def ref(sym: TermSymbol)(implicit ctx: Context): tpd.NameTree = ref(sym.termRef)
/** new C(args) */
def New(tp: Type, args: List[Tree])(implicit ctx: Context): Apply =
diff --git a/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala b/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala
index e5890b122..3c7a1ec4f 100644
--- a/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala
+++ b/src/dotty/tools/dotc/parsing/SymbolicXMLBuilder.scala
@@ -182,81 +182,81 @@ abstract class SymbolicXMLBuilder(preserveWS: Boolean)(implicit ctx: Context) {
def element(qname: String, attrMap: mutable.Map[String, Tree], empty: Boolean, args: Seq[Tree])(implicit cpos: Position): Tree = {
val tpos = cpos.transparent
- implicit val cpos: Position = tpos
-
- def handleNamespaceBinding(pre: String, z: String): Tree = {
- def mkAssign(t: Tree): Tree = Assign(
- Ident(_tmpscope),
- New(_scala_xml_NamespaceBinding, LL(const(pre), t, Ident(_tmpscope)))
- )
-
- val uri1 = attrMap(z) match {
- case Apply(_, List(uri @ Literal(Constant(_)))) => mkAssign(uri)
- case Select(_, nme.Nil) => mkAssign(const(null)) // allow for xmlns="" -- bug #1626
- case x => mkAssign(x)
+ locally {
+ implicit val cpos: Position = tpos
+
+ def handleNamespaceBinding(pre: String, z: String): Tree = {
+ def mkAssign(t: Tree): Tree = Assign(
+ Ident(_tmpscope),
+ New(_scala_xml_NamespaceBinding, LL(const(pre), t, Ident(_tmpscope))))
+
+ val uri1 = attrMap(z) match {
+ case Apply(_, List(uri @ Literal(Constant(_)))) => mkAssign(uri)
+ case Select(_, nme.Nil) => mkAssign(const(null)) // allow for xmlns="" -- bug #1626
+ case x => mkAssign(x)
+ }
+ attrMap -= z
+ uri1
}
- attrMap -= z
- uri1
- }
- /** Extract all the namespaces from the attribute map. */
- val namespaces: List[Tree] =
- for (z <- attrMap.keys.toList ; if z startsWith xmlns) yield {
- val ns = splitPrefix(z) match {
- case (Some(_), rest) => rest
- case _ => null
+ /** Extract all the namespaces from the attribute map. */
+ val namespaces: List[Tree] =
+ for (z <- attrMap.keys.toList; if z startsWith xmlns) yield {
+ val ns = splitPrefix(z) match {
+ case (Some(_), rest) => rest
+ case _ => null
+ }
+ handleNamespaceBinding(ns, z)
}
- handleNamespaceBinding(ns, z)
+
+ val (pre, newlabel) = splitPrefix(qname) match {
+ case (Some(p), x) => (p, x)
+ case (None, x) => (null, x)
}
- val (pre, newlabel) = splitPrefix(qname) match {
- case (Some(p), x) => (p, x)
- case (None, x) => (null, x)
- }
+ def mkAttributeTree(pre: String, key: String, value: Tree) = {
+ // XXX this is where we'd like to put Select(value, nme.toString_) for #1787
+ // after we resolve the Some(foo) situation.
+ val baseArgs = List(const(key), value, Ident(_md))
+ val (clazz, attrArgs) =
+ if (pre == null) (_scala_xml_UnprefixedAttribute, baseArgs)
+ else (_scala_xml_PrefixedAttribute, const(pre) :: baseArgs)
- def mkAttributeTree(pre: String, key: String, value: Tree) = {
- // XXX this is where we'd like to put Select(value, nme.toString_) for #1787
- // after we resolve the Some(foo) situation.
- val baseArgs = List(const(key), value, Ident(_md))
- val (clazz, attrArgs) =
- if (pre == null) (_scala_xml_UnprefixedAttribute, baseArgs)
- else (_scala_xml_PrefixedAttribute , const(pre) :: baseArgs)
+ Assign(Ident(_md), New(clazz, LL(attrArgs: _*)))
+ }
- Assign(Ident(_md), New(clazz, LL(attrArgs: _*)))
- }
+ def handlePrefixedAttribute(pre: String, key: String, value: Tree) = mkAttributeTree(pre, key, value)
+ def handleUnprefixedAttribute(key: String, value: Tree) = mkAttributeTree(null, key, value)
- def handlePrefixedAttribute(pre: String, key: String, value: Tree) = mkAttributeTree(pre, key, value)
- def handleUnprefixedAttribute(key: String, value: Tree) = mkAttributeTree(null, key, value)
+ val attributes: List[Tree] =
+ for ((k, v) <- attrMap.toList.reverse) yield splitPrefix(k) match {
+ case (Some(pre), rest) => handlePrefixedAttribute(pre, rest, v)
+ case _ => handleUnprefixedAttribute(k, v)
+ }
- val attributes: List[Tree] =
- for ((k, v) <- attrMap.toList.reverse) yield splitPrefix(k) match {
- case (Some(pre), rest) => handlePrefixedAttribute(pre, rest, v)
- case _ => handleUnprefixedAttribute(k, v)
- }
+ lazy val scopeDef = ValDef(Modifiers(), _scope, _scala_xml_NamespaceBinding, Ident(_tmpscope))
+ lazy val tmpScopeDef = ValDef(Modifiers(Mutable), _tmpscope, _scala_xml_NamespaceBinding, Ident(_scope))
+ lazy val metadataDef = ValDef(Modifiers(Mutable), _md, _scala_xml_MetaData, _scala_xml_Null)
+ val makeSymbolicAttrs = if (!attributes.isEmpty) Ident(_md) else _scala_xml_Null
+
+ val (attrResult, nsResult) =
+ (attributes.isEmpty, namespaces.isEmpty) match {
+ case (true, true) => (Nil, Nil)
+ case (true, false) => (scopeDef :: Nil, tmpScopeDef :: namespaces)
+ case (false, true) => (metadataDef :: attributes, Nil)
+ case (false, false) => (scopeDef :: metadataDef :: attributes, tmpScopeDef :: namespaces)
+ }
- lazy val scopeDef = ValDef(Modifiers(), _scope, _scala_xml_NamespaceBinding, Ident(_tmpscope))
- lazy val tmpScopeDef = ValDef(Modifiers(Mutable), _tmpscope, _scala_xml_NamespaceBinding, Ident(_scope))
- lazy val metadataDef = ValDef(Modifiers(Mutable), _md, _scala_xml_MetaData, _scala_xml_Null)
- val makeSymbolicAttrs = if (!attributes.isEmpty) Ident(_md) else _scala_xml_Null
-
- val (attrResult, nsResult) =
- (attributes.isEmpty, namespaces.isEmpty) match {
- case (true , true) => (Nil, Nil)
- case (true , false) => (scopeDef :: Nil, tmpScopeDef :: namespaces)
- case (false, true) => (metadataDef :: attributes, Nil)
- case (false, false) => (scopeDef :: metadataDef :: attributes, tmpScopeDef :: namespaces)
- }
+ val body = mkXML(
+ false,
+ const(pre),
+ const(newlabel),
+ makeSymbolicAttrs,
+ Ident(_scope),
+ empty,
+ args)
- val body = mkXML(
- false,
- const(pre),
- const(newlabel),
- makeSymbolicAttrs,
- Ident(_scope),
- empty,
- args
- )
-
- Block(nsResult, Block(attrResult, body))
+ Block(nsResult, Block(attrResult, body))
+ }
}
}