From 7184fe0d3740ac8558067c18bdf449a65a8a26b9 Mon Sep 17 00:00:00 2001 From: Den Shabalin Date: Mon, 8 Jul 2013 20:48:17 +0200 Subject: implements quasiquotes - Additions to the reflection API: - The Quasiquotes implicit class that defines `q`, `tq`, `pq` and `cq` interpolators which now become a part of the `scala.reflect.api. Universe`. - Implementations of the interpolators are macro-based and are hardwired through `FastTrack`. - The `Liftable` class and the `StandardLiftables` slice of the cake that provide a type class and a bunch of its instances that allow to easily splice user-defined types into quasiquotes. - Additional methods in `BuildUtils` that are used by the quasiquote macro to generate trees, notably: - `SyntacticClassDef`. An extractor/constructor that allows to construct and deconstruct classes using arguments that mirror syntactic form of ClassDefs (e.g. constructor outside of the body). - `TupleN`, `TupleTypeN`. Extractor/constructor for easy construction of ast that represents a tuple term or type with given amount of elements. - Actual implementation of quasiquotes in the `scala.tools.reflect. quasiquotes` package which is organized into a cake called `Quasiquotes` with slices introducing core abstractions necessary to splice into Scala syntax, routines for interfacing with the parser, and customized reifiers for tree construction and deconstruction. --- src/reflect/scala/reflect/api/BuildUtils.scala | 42 ++++++++ src/reflect/scala/reflect/api/Liftable.scala | 32 ++++++ src/reflect/scala/reflect/api/Quasiquotes.scala | 20 ++++ .../scala/reflect/api/StandardLiftables.scala | 36 +++++++ src/reflect/scala/reflect/api/Universe.scala | 2 + .../scala/reflect/internal/BuildUtils.scala | 120 +++++++++++++++++++++ .../scala/reflect/internal/Definitions.scala | 34 ++++++ src/reflect/scala/reflect/internal/StdNames.scala | 49 +++++++++ 8 files changed, 335 insertions(+) create mode 100644 src/reflect/scala/reflect/api/Liftable.scala create mode 100644 src/reflect/scala/reflect/api/Quasiquotes.scala create mode 100644 src/reflect/scala/reflect/api/StandardLiftables.scala (limited to 'src/reflect') diff --git a/src/reflect/scala/reflect/api/BuildUtils.scala b/src/reflect/scala/reflect/api/BuildUtils.scala index 2e95a01176..c568cf74c0 100644 --- a/src/reflect/scala/reflect/api/BuildUtils.scala +++ b/src/reflect/scala/reflect/api/BuildUtils.scala @@ -66,6 +66,8 @@ private[reflect] trait BuildUtils { self: Universe => def Ident(sym: Symbol): Ident + def Block(stats: List[Tree]): Block + def TypeTree(tp: Type): TypeTree def thisPrefix(sym: Symbol): Type @@ -73,5 +75,45 @@ private[reflect] trait BuildUtils { self: Universe => def setType[T <: Tree](tree: T, tpe: Type): T def setSymbol[T <: Tree](tree: T, sym: Symbol): T + + def mkAnnotationCtor(tree: Tree, args: List[Tree]): Tree + + val FlagsAsBits: FlagsAsBitsExtractor + + trait FlagsAsBitsExtractor { + def unapply(flags: Long): Option[Long] + } + + val TypeApplied: TypeAppliedExtractor + + trait TypeAppliedExtractor { + def unapply(tree: Tree): Some[(Tree, List[Tree])] + } + + val Applied: AppliedExtractor + + trait AppliedExtractor { + def unapply(tree: Tree): Some[(Tree, List[List[Tree]])] + } + + val SyntacticClassDef: SyntacticClassDefExtractor + + trait SyntacticClassDefExtractor { + def apply(mods: Modifiers, name: TypeName, tparams: List[TypeDef], + constrMods: Modifiers, vparamss: List[List[ValDef]], parents: List[Tree], + selfdef: ValDef, body: List[Tree]): Tree + def unapply(tree: Tree): Option[(Modifiers, TypeName, List[TypeDef], Modifiers, + List[List[ValDef]], List[Tree], ValDef, List[Tree])] + } + + val TupleN: TupleNExtractor + val TupleTypeN: TupleNExtractor + + trait TupleNExtractor { + def apply(args: List[Tree]): Tree + def unapply(tree: Tree): Option[List[Tree]] + } + + def RefTree(qual: Tree, sym: Symbol): Tree } } diff --git a/src/reflect/scala/reflect/api/Liftable.scala b/src/reflect/scala/reflect/api/Liftable.scala new file mode 100644 index 0000000000..8f6fe066dd --- /dev/null +++ b/src/reflect/scala/reflect/api/Liftable.scala @@ -0,0 +1,32 @@ +package scala.reflect +package api + +trait Liftable[T] { + def apply(universe: api.Universe, value: T): universe.Tree +} + +object Liftable { + private class LiftableConstant[T] extends Liftable[T] { + def apply(universe: Universe, value: T): universe.Tree = + universe.Literal(universe.Constant(value)) + } + + implicit lazy val liftByte: Liftable[Byte] = new LiftableConstant[Byte] + implicit lazy val liftShort: Liftable[Short] = new LiftableConstant[Short] + implicit lazy val liftChar: Liftable[Char] = new LiftableConstant[Char] + implicit lazy val liftInt: Liftable[Int] = new LiftableConstant[Int] + implicit lazy val liftLong: Liftable[Long] = new LiftableConstant[Long] + implicit lazy val liftFloat: Liftable[Float] = new LiftableConstant[Float] + implicit lazy val liftDouble: Liftable[Double] = new LiftableConstant[Double] + implicit lazy val liftBoolean: Liftable[Boolean] = new LiftableConstant[Boolean] + implicit lazy val liftString: Liftable[String] = new LiftableConstant[String] + implicit lazy val liftUnit: Liftable[Unit] = new LiftableConstant[Unit] + + implicit lazy val liftScalaSymbol: Liftable[scala.Symbol] = new Liftable[scala.Symbol] { + def apply(universe: Universe, value: scala.Symbol): universe.Tree = { + import universe._ + val symbol = Select(Ident(TermName("scala")), TermName("Symbol")) + Apply(symbol, List(Literal(Constant(value.name)))) + } + } +} diff --git a/src/reflect/scala/reflect/api/Quasiquotes.scala b/src/reflect/scala/reflect/api/Quasiquotes.scala new file mode 100644 index 0000000000..3895b8b95f --- /dev/null +++ b/src/reflect/scala/reflect/api/Quasiquotes.scala @@ -0,0 +1,20 @@ +package scala.reflect +package api + +import language.experimental.macros + +trait Quasiquotes { self: Universe => + + // implementation is hardwired to `dispatch` method of `scala.tools.reflect.quasiquotes.Quasiquotes` + // using the mechanism implemented in `scala.tools.reflect.FastTrack` + implicit class Quasiquote(ctx: StringContext) { + protected trait api { + def apply(args: Any*): Any = macro ??? + def unapply(subpatterns: Any*): Option[Any] = macro ??? + } + object q extends api + object tq extends api + object cq extends api + object pq extends api + } +} diff --git a/src/reflect/scala/reflect/api/StandardLiftables.scala b/src/reflect/scala/reflect/api/StandardLiftables.scala new file mode 100644 index 0000000000..ecea550225 --- /dev/null +++ b/src/reflect/scala/reflect/api/StandardLiftables.scala @@ -0,0 +1,36 @@ +package scala.reflect +package api + +trait StandardLiftables { self: Universe => + + private def requireSameUniverse[T](universe: Universe, tp: String, value: T) = + require(universe eq self, s"Can't lift $tp ${showRaw(value)} from universe ${showRaw(universe)} using lift$tp defined for ${showRaw(self)}.") + + implicit def liftExpr[T <: Expr[_]]: Liftable[T] = new Liftable[T] { + def apply(universe: Universe, value: T): universe.Tree = { + requireSameUniverse(universe, "Expr", value) + value.tree.asInstanceOf[universe.Tree] + } + } + + implicit def liftType[T <: Type]: Liftable[T] = new Liftable[T] { + def apply(universe: Universe, value: T): universe.Tree = { + requireSameUniverse(universe, "Type", value) + universe.TypeTree(value.asInstanceOf[universe.Type]) + } + } + + implicit def liftTypeTag[T <: WeakTypeTag[_]]: Liftable[T] = new Liftable[T] { + def apply(universe: Universe, value: T): universe.Tree = { + requireSameUniverse(universe, "TypeTag", value) + universe.TypeTree(value.asInstanceOf[universe.WeakTypeTag[_]].tpe) + } + } + + implicit def liftConstant[T <: Constant]: Liftable[T] = new Liftable[T] { + def apply(universe: Universe, value: T): universe.Tree = { + requireSameUniverse(universe, "Constant", value) + universe.Literal(value.asInstanceOf[universe.Constant]) + } + } +} diff --git a/src/reflect/scala/reflect/api/Universe.scala b/src/reflect/scala/reflect/api/Universe.scala index cb629f9c5a..77b4827eab 100644 --- a/src/reflect/scala/reflect/api/Universe.scala +++ b/src/reflect/scala/reflect/api/Universe.scala @@ -72,10 +72,12 @@ abstract class Universe extends Symbols with ImplicitTags with StandardDefinitions with StandardNames + with StandardLiftables with BuildUtils with Mirrors with Printers with Importers + with Quasiquotes { /** Use `refiy` to produce the abstract syntax tree representing a given Scala expression. * diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index ece2d28be3..6526c4ce12 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -2,7 +2,10 @@ package scala package reflect package internal +import Flags._ + trait BuildUtils { self: SymbolTable => + import definitions.{TupleClass, MaxTupleArity, ScalaPackage, UnitClass} class BuildImpl extends BuildApi { @@ -52,6 +55,12 @@ trait BuildUtils { self: SymbolTable => def Ident(sym: Symbol): Ident = self.Ident(sym) + def Block(stats: List[Tree]): Block = stats match { + case Nil => self.Block(Nil, Literal(Constant(()))) + case elem :: Nil => self.Block(Nil, elem) + case elems => self.Block(elems.init, elems.last) + } + def TypeTree(tp: Type): TypeTree = self.TypeTree(tp) def thisPrefix(sym: Symbol): Type = sym.thisPrefix @@ -59,6 +68,117 @@ trait BuildUtils { self: SymbolTable => def setType[T <: Tree](tree: T, tpe: Type): T = { tree.setType(tpe); tree } def setSymbol[T <: Tree](tree: T, sym: Symbol): T = { tree.setSymbol(sym); tree } + + def mkAnnotationCtor(tree: Tree, args: List[Tree]): Tree = tree match { + case ident: Ident => Apply(self.Select(New(ident), nme.CONSTRUCTOR: TermName), args) + case call @ Apply(Select(New(ident: Ident), nme.CONSTRUCTOR), _) => + if (args.nonEmpty) + throw new IllegalArgumentException("Can't splice annotation that already contains args with extra args, consider merging these lists together") + call + case _ => throw new IllegalArgumentException(s"Tree ${showRaw(tree)} isn't a correct representation of annotation, consider passing Ident as a first argument") + } + + object FlagsAsBits extends FlagsAsBitsExtractor { + def unapply(flags: Long): Option[Long] = Some(flags) + } + + object TypeApplied extends TypeAppliedExtractor { + def unapply(tree: Tree): Some[(Tree, List[Tree])] = tree match { + case TypeApply(fun, targs) => Some((fun, targs)) + case _ => Some((tree, Nil)) + } + } + + object Applied extends AppliedExtractor { + def unapply(tree: Tree): Some[(Tree, List[List[Tree]])] = { + val treeInfo.Applied(fun, targs, argss) = tree + targs match { + case Nil => Some((fun, argss)) + case _ => Some((TypeApply(fun, targs), argss)) + } + } + } + + object SyntacticClassDef extends SyntacticClassDefExtractor { + def apply(mods: Modifiers, name: TypeName, tparams: List[TypeDef], + constrMods: Modifiers, vparamss: List[List[ValDef]], parents: List[Tree], + selfdef: ValDef, body: List[Tree]): Tree = + ClassDef(mods, name, tparams, gen.mkTemplate(parents, selfdef, constrMods, vparamss, body, NoPosition)) + + def unapply(tree: Tree): Option[(Modifiers, TypeName, List[TypeDef], Modifiers, + List[List[ValDef]], List[Tree], ValDef, List[Tree])] = tree match { + case ClassDef(mods, name, tparams, Template(parents, selfdef, tbody)) => + // extract generated fieldDefs and constructor + val (defs, (ctor: DefDef) :: body) = tbody.splitAt(tbody.indexWhere { + case DefDef(_, nme.CONSTRUCTOR, _, _, _, _) => true + case _ => false + }) + val (earlyDefs, fieldDefs) = defs.span(treeInfo.isEarlyDef) + + // undo conversion from (implicit ... ) to ()(implicit ... ) when its the only parameter section + val vparamssRestoredImplicits = ctor.vparamss match { + case Nil :: rest if !rest.isEmpty && !rest.head.isEmpty && rest.head.head.mods.isImplicit => rest + case other => other + } + + // undo flag modifications by mergeing flag info from constructor args and fieldDefs + val modsMap = fieldDefs.map { case ValDef(mods, name, _, _) => name -> mods }.toMap + val vparamss = mmap(vparamssRestoredImplicits) { vd => + val originalMods = modsMap(vd.name) | (vd.mods.flags & DEFAULTPARAM) + atPos(vd.pos)(ValDef(originalMods, vd.name, vd.tpt, vd.rhs)) + } + + Some((mods, name, tparams, ctor.mods, vparamss, parents, selfdef, earlyDefs ::: body)) + case _ => + None + } + } + + object TupleN extends TupleNExtractor { + def apply(args: List[Tree]): Tree = args match { + case Nil => Literal(Constant(())) + case _ => + require(args.length <= MaxTupleArity, s"Tuples with arity bigger than $MaxTupleArity aren't supported") + self.Apply(TupleClass(args.length).companionModule, args: _*) + } + + def unapply(tree: Tree): Option[List[Tree]] = tree match { + case Literal(Constant(())) => + Some(Nil) + case Apply(id: Ident, args) + if args.length <= MaxTupleArity && id.symbol == TupleClass(args.length).companionModule => + Some(args) + case Apply(Select(Ident(nme.scala_), TermName(tuple)), args) + if args.length <= MaxTupleArity && tuple == TupleClass(args.length).name => + Some(args) + case _ => + None + } + } + + object TupleTypeN extends TupleNExtractor { + def apply(args: List[Tree]): Tree = args match { + case Nil => self.Select(self.Ident(nme.scala_), tpnme.Unit) + case _ => + require(args.length <= MaxTupleArity, s"Tuples with arity bigger than $MaxTupleArity aren't supported") + AppliedTypeTree(Ident(TupleClass(args.length)), args) + } + + def unapply(tree: Tree): Option[List[Tree]] = tree match { + case Select(Ident(nme.scala_), tpnme.Unit) => + Some(Nil) + case AppliedTypeTree(id: Ident, args) + if args.length <= MaxTupleArity && id.symbol == TupleClass(args.length) => + Some(args) + case AppliedTypeTree(Select(id @ Ident(nme.scala_), TermName(tuple)), args) + if args.length <= MaxTupleArity && id.symbol == ScalaPackage && tuple == TupleClass(args.length).name => + Some(args) + case _ => + None + } + } + + def RefTree(qual: Tree, sym: Symbol) = self.RefTree(qual, sym.name) setSymbol sym } val build: BuildApi = new BuildImpl diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index bf8ef79a63..d3b9c38ee1 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -442,6 +442,7 @@ trait Definitions extends api.StandardDefinitions { // collections classes lazy val ConsClass = requiredClass[scala.collection.immutable.::[_]] lazy val IteratorClass = requiredClass[scala.collection.Iterator[_]] + lazy val IterableClass = requiredClass[scala.collection.Iterable[_]] lazy val ListClass = requiredClass[scala.collection.immutable.List[_]] lazy val SeqClass = requiredClass[scala.collection.Seq[_]] lazy val StringBuilderClass = requiredClass[scala.collection.mutable.StringBuilder] @@ -520,6 +521,7 @@ trait Definitions extends api.StandardDefinitions { lazy val TypeCreatorClass = getClassIfDefined("scala.reflect.api.TypeCreator") // defined in scala-reflect.jar, so we need to be careful lazy val TreeCreatorClass = getClassIfDefined("scala.reflect.api.TreeCreator") // defined in scala-reflect.jar, so we need to be careful + lazy val LiftableClass = getClassIfDefined("scala.reflect.api.Liftable") // defined in scala-reflect.jar, so we need to be careful lazy val MacroClass = getClassIfDefined("scala.reflect.macros.Macro") // defined in scala-reflect.jar, so we need to be careful lazy val MacroContextClass = getClassIfDefined("scala.reflect.macros.Context") // defined in scala-reflect.jar, so we need to be careful @@ -534,6 +536,11 @@ trait Definitions extends api.StandardDefinitions { lazy val StringContextClass = requiredClass[scala.StringContext] def StringContext_f = getMemberMethod(StringContextClass, nme.f) + lazy val QuasiquoteClass = if (ApiUniverseClass != NoSymbol) getMember(ApiUniverseClass, tpnme.Quasiquote) else NoSymbol + lazy val QuasiquoteClass_api = if (QuasiquoteClass != NoSymbol) getMember(QuasiquoteClass, tpnme.api) else NoSymbol + lazy val QuasiquoteClass_api_apply = if (QuasiquoteClass_api != NoSymbol) getMember(QuasiquoteClass_api, nme.apply) else NoSymbol + lazy val QuasiquoteClass_api_unapply = if (QuasiquoteClass_api != NoSymbol) getMember(QuasiquoteClass_api, nme.unapply) else NoSymbol + lazy val ScalaSignatureAnnotation = requiredClass[scala.reflect.ScalaSignature] lazy val ScalaLongSignatureAnnotation = requiredClass[scala.reflect.ScalaLongSignature] @@ -645,6 +652,10 @@ trait Definitions extends api.StandardDefinitions { isNonTrivial && isMacroCompatible } + def isLiftableType(tp: Type) = tp <:< classExistentialType(LiftableClass) + + def isIterableType(tp: Type) = tp <:< classExistentialType(IterableClass) + lazy val ProductRootClass: ClassSymbol = requiredClass[scala.Product] def Product_productArity = getMemberMethod(ProductRootClass, nme.productArity) def Product_productElement = getMemberMethod(ProductRootClass, nme.productElement) @@ -1185,5 +1196,28 @@ trait Definitions extends api.StandardDefinitions { val _ = symbolsNotPresentInBytecode isInitialized = true } //init + + class UniverseDependentTypes(universe: Tree) { + lazy val universeType = universe.tpe + lazy val universeSym = universe.symbol + lazy val nameType = universeMemberType(tpnme.Name) + lazy val termNameType = universeMemberType(tpnme.TypeName) + lazy val typeNameType = universeMemberType(tpnme.TermName) + lazy val modsType = universeMemberType(tpnme.Modifiers) + lazy val flagsType = universeMemberType(tpnme.FlagSet) + lazy val symbolType = universeMemberType(tpnme.Symbol) + lazy val treeType0 = universeMemberType(tpnme.Tree) + lazy val treeType = universeMemberType(tpnme.Tree) + lazy val typeDefType = universeMemberType(tpnme.TypeDef) + lazy val caseDefType = universeMemberType(tpnme.CaseDef) + lazy val iterableTreeType = appliedType(IterableClass, treeType) + lazy val iterableCaseDefType = appliedType(IterableClass, caseDefType) + lazy val iterableIterableTreeType = appliedType(IterableClass, iterableTreeType) + lazy val listTreeType = appliedType(ListClass, treeType) + lazy val listListTreeType = appliedType(ListClass, listTreeType) + lazy val optionTreeType = appliedType(OptionClass, treeType) + lazy val optionNameType = appliedType(OptionClass, nameType) + def universeMemberType(name: TypeName) = universe.tpe.memberType(getTypeMember(universe.symbol, name)) + } } } diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 30aaaa1f3a..64713b8d41 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -216,23 +216,39 @@ trait StdNames { final val Any: NameType = "Any" final val AnyVal: NameType = "AnyVal" + final val FlagSet: NameType = "FlagSet" final val Mirror: NameType = "Mirror" + final val Modifiers: NameType = "Modifiers" final val Nothing: NameType = "Nothing" final val Null: NameType = "Null" final val Object: NameType = "Object" + final val Option: NameType = "Option" final val PrefixType: NameType = "PrefixType" final val Product: NameType = "Product" final val Serializable: NameType = "Serializable" final val Singleton: NameType = "Singleton" final val Throwable: NameType = "Throwable" + final val api: NameType = "api" final val Annotation: NameType = "Annotation" + final val CaseDef: NameType = "CaseDef" final val ClassfileAnnotation: NameType = "ClassfileAnnotation" final val ClassManifest: NameType = "ClassManifest" final val Enum: NameType = "Enum" final val Group: NameType = "Group" + final val Name: NameType = "Name" final val Tree: NameType = "Tree" + final val TermName: NameType = "TermName" final val Type : NameType = "Type" + final val TypeName: NameType = "TypeName" + final val TypeDef: NameType = "TypeDef" + final val Tuple: NameType = "Tuple" + final val Universe: NameType = "Universe" + final val Quasiquote: NameType = "Quasiquote" + + // quasiquote-specific names + final val QUASIQUOTE_MODS: NameType = "$quasiquote$mods$" + final val QUASIQUOTE_TUPLE: NameType = "$quasiquote$tuple$" // Annotation simple names, used in Namer final val BeanPropertyAnnot: NameType = "BeanProperty" @@ -304,6 +320,10 @@ trait StdNames { val REIFY_FREE_THIS_SUFFIX: NameType = "$this" val REIFY_FREE_VALUE_SUFFIX: NameType = "$value" val REIFY_SYMDEF_PREFIX: NameType = "symdef$" + val QUASIQUOTE_PREFIX: String = "qq$" + val QUASIQUOTE_FILE: String = "" + val QUASIQUOTE_TUPLE: NameType = "$quasiquote$tuple$" + val QUASIQUOTE_CASE: NameType = "$quasiquote$case$" val MIXIN_CONSTRUCTOR: NameType = "$init$" val MODULE_INSTANCE_FIELD: NameType = NameTransformer.MODULE_INSTANCE_NAME // "MODULE$" val OUTER: NameType = "$outer" @@ -539,17 +559,23 @@ trait StdNames { val Annotation: NameType = "Annotation" val Any: NameType = "Any" val AnyVal: NameType = "AnyVal" + val Apply: NameType = "Apply" + val Applied: NameType = "Applied" val ArrayAnnotArg: NameType = "ArrayAnnotArg" + val Block: NameType = "Block" val ConstantType: NameType = "ConstantType" val EmptyPackage: NameType = "EmptyPackage" val EmptyPackageClass: NameType = "EmptyPackageClass" + val False : NameType = "False" val Flag : NameType = "Flag" + val FlagsAsBits: NameType = "FlagsAsBits" val Ident: NameType = "Ident" val Import: NameType = "Import" val Literal: NameType = "Literal" val LiteralAnnotArg: NameType = "LiteralAnnotArg" val Modifiers: NameType = "Modifiers" val NestedAnnotArg: NameType = "NestedAnnotArg" + val New: NameType = "New" val NoFlags: NameType = "NoFlags" val NoSymbol: NameType = "NoSymbol" val Nothing: NameType = "Nothing" @@ -560,10 +586,15 @@ trait StdNames { val Select: NameType = "Select" val SelectFromTypeTree: NameType = "SelectFromTypeTree" val StringContext: NameType = "StringContext" + val SyntacticClassDef: NameType = "SyntacticClassDef" val This: NameType = "This" val ThisType: NameType = "ThisType" + val True : NameType = "True" val Tuple2: NameType = "Tuple2" + val TupleN: NameType = "TupleN" + val TupleTypeN: NameType = "TupleTypeN" val TYPE_ : NameType = "TYPE" + val TypeApplied: NameType = "TypeApplied" val TypeRef: NameType = "TypeRef" val TypeTree: NameType = "TypeTree" val UNIT : NameType = "UNIT" @@ -593,6 +624,7 @@ trait StdNames { val checkInitialized: NameType = "checkInitialized" val classOf: NameType = "classOf" val clone_ : NameType = "clone" + val collection: NameType = "collection" val conforms: NameType = "conforms" val copy: NameType = "copy" val create: NameType = "create" @@ -619,10 +651,13 @@ trait StdNames { val find_ : NameType = "find" val flagsFromBits : NameType = "flagsFromBits" val flatMap: NameType = "flatMap" + val flatten: NameType = "flatten" + val foldLeft: NameType = "foldLeft" val foreach: NameType = "foreach" val get: NameType = "get" val hashCode_ : NameType = "hashCode" val hash_ : NameType = "hash" + val immutable: NameType = "immutable" val implicitly: NameType = "implicitly" val in: NameType = "in" val inlinedEquals: NameType = "inlinedEquals" @@ -644,12 +679,15 @@ trait StdNames { val materializeWeakTypeTag: NameType = "materializeWeakTypeTag" val materializeTypeTag: NameType = "materializeTypeTag" val moduleClass : NameType = "moduleClass" + val mkAnnotationCtor: NameType = "mkAnnotationCtor" val ne: NameType = "ne" val newArray: NameType = "newArray" val newFreeTerm: NameType = "newFreeTerm" val newFreeType: NameType = "newFreeType" val newNestedSymbol: NameType = "newNestedSymbol" val newScopeWith: NameType = "newScopeWith" + val nmeCONSTRUCTOR: NameType = "CONSTRUCTOR" + val nmeNme: NameType = "nme" val notifyAll_ : NameType = "notifyAll" val notify_ : NameType = "notify" val null_ : NameType = "null" @@ -665,6 +703,7 @@ trait StdNames { val runtime: NameType = "runtime" val runtimeClass: NameType = "runtimeClass" val runtimeMirror: NameType = "runtimeMirror" + val RefTree: NameType = "RefTree" val scala_ : NameType = "scala" val selectDynamic: NameType = "selectDynamic" val selectOverloadedMethod: NameType = "selectOverloadedMethod" @@ -684,6 +723,7 @@ trait StdNames { val this_ : NameType = "this" val thisPrefix : NameType = "thisPrefix" val toArray: NameType = "toArray" + val toList: NameType = "toList" val toObjectArray : NameType = "toObjectArray" val TopScope: NameType = "TopScope" val toString_ : NameType = "toString" @@ -694,6 +734,7 @@ trait StdNames { val typedProductIterator: NameType = "typedProductIterator" val TypeName: NameType = "TypeName" val typeTagToManifest: NameType = "typeTagToManifest" + val unapply: NameType = "unapply" val unapplySeq: NameType = "unapplySeq" val unbox: NameType = "unbox" @@ -708,6 +749,12 @@ trait StdNames { val withFilter: NameType = "withFilter" val zero: NameType = "zero" + // quasiquote interpolators: + val q: NameType = "q" + val tq: NameType = "tq" + val cq: NameType = "cq" + val pq: NameType = "pq" + // unencoded operators object raw { final val BANG : NameType = "!" @@ -744,6 +791,7 @@ trait StdNames { val ADD = encode("+") val AND = encode("&") val ASR = encode(">>") + val CONS = encode("::") val DIV = encode("/") val EQ = encode("==") val EQL = encode("=") @@ -760,6 +808,7 @@ trait StdNames { val NE = encode("!=") val OR = encode("|") val PLUS = ADD // technically redundant, but ADD looks funny with MINUS + val PLUSPLUS = encode("++") val SUB = MINUS // ... as does SUB with PLUS val XOR = encode("^") val ZAND = encode("&&") -- cgit v1.2.3