From 79103ea82a369bc1679a9bd927f764d9ff733b66 Mon Sep 17 00:00:00 2001 From: Marconi Lanna Date: Tue, 5 Dec 2017 13:08:58 -0500 Subject: [PATCH] Replace deprecated nme and tpnme with termNames and typeNames --- _ja/overviews/reflection/annotations-names-scopes.md | 12 ++++++------ .../reflection/environment-universes-mirrors.md | 2 +- _ja/overviews/reflection/overview.md | 2 +- _ja/overviews/reflection/symbols-trees-types.md | 2 +- _overviews/reflection/annotations-names-scopes.md | 12 ++++++------ .../reflection/environment-universes-mirrors.md | 2 +- _overviews/reflection/overview.md | 2 +- _overviews/reflection/symbols-trees-types.md | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/_ja/overviews/reflection/annotations-names-scopes.md b/_ja/overviews/reflection/annotations-names-scopes.md index ef712b50b5..ad8a9322ac 100644 --- a/_ja/overviews/reflection/annotations-names-scopes.md +++ b/_ja/overviews/reflection/annotations-names-scopes.md @@ -90,7 +90,7 @@ Scala または Java アノテーションに対しては `scalaArgs` は空で Scala のプログラムにおいて、「`_root_`」のような特定の名前は特殊な意味を持つ。 そのため、それらは Scala の構造物をリフレクションを用いてアクセスするのに欠かすことができない。 例えば、リフレクションを用いてコンストラクタを呼び出すには**標準名** (standard name) -`universe.nme.CONSTRUCTOR` を用いる。これは、JVM 上でのコンストラクタ名である項名「``」を指す。 +`universe.termNames.CONSTRUCTOR` を用いる。これは、JVM 上でのコンストラクタ名である項名「``」を指す。 - 「``」、「`package`」、「`_root_`」のような**標準項名** (standard term names) と - 「``」、「`_`」、「`_*`」のような**標準型名** (standard type names) @@ -98,7 +98,7 @@ Scala のプログラムにおいて、「`_root_`」のような特定の名前 の両方が存在する。 「`package`」のようないくつかの名前は型名と項名の両方が存在する。 -標準名は `Universe` クラスの `nme` と `tpnme` というメンバとして公開されている。 +標準名は `Universe` クラスの `termNames` と `typeNames` というメンバとして公開されている。 全ての標準名の仕様は [API doc](http://www.scala-lang.org/api/current/scala-reflect/scala/reflect/api/StandardNames.html) を参照。 ## スコープ @@ -307,9 +307,9 @@ Java の列挙要素への参照はシンボル (`scala.reflect.api.Symbols#Symb List(Ident(TypeName("AnyRef"))), emptyValDef, List( - DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List( - Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), + Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("x"), List(), List(), TypeTree(), Literal(Constant(2))))))), @@ -329,9 +329,9 @@ Java の列挙要素への参照はシンボル (`scala.reflect.api.Symbols#Symb List(Ident[4](TypeName("AnyRef"))), emptyValDef, List( - DefDef[2](Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree[3](), + DefDef[2](Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree[3](), Block[1](List( - Apply[4](Select[5](Super[6](This[3](TypeName("C")), tpnme.EMPTY), ...))), + Apply[4](Select[5](Super[6](This[3](TypeName("C")), typeNames.EMPTY), ...))), Literal[1](Constant(())))), DefDef[2](Modifiers(), TermName("x"), List(), List(), TypeTree[7](), Literal[8](Constant(2))))))), diff --git a/_ja/overviews/reflection/environment-universes-mirrors.md b/_ja/overviews/reflection/environment-universes-mirrors.md index f4177f63a3..c1c87199ef 100644 --- a/_ja/overviews/reflection/environment-universes-mirrors.md +++ b/_ja/overviews/reflection/environment-universes-mirrors.md @@ -151,7 +151,7 @@ invoker ミラーを作成することができる。 scala> val cm = m.reflectClass(classC) cm: scala.reflect.runtime.universe.ClassMirror = class mirror for C (bound to null) - scala> val ctorC = ru.typeOf[C].decl(ru.nme.CONSTRUCTOR).asMethod + scala> val ctorC = ru.typeOf[C].decl(ru.termNames.CONSTRUCTOR).asMethod ctorC: scala.reflect.runtime.universe.MethodSymbol = constructor C scala> val ctorm = cm.reflectConstructor(ctorC) diff --git a/_ja/overviews/reflection/overview.md b/_ja/overviews/reflection/overview.md index aa60b5b648..432b9f696f 100644 --- a/_ja/overviews/reflection/overview.md +++ b/_ja/overviews/reflection/overview.md @@ -118,7 +118,7 @@ Scala コンパイラが持つ型情報を全ては入手できない可能性 次に、`reflectClass` メソッドを使って `Person` クラスの `ClassMirror` を取得する。 `ClassMirror` は `Person` クラスのコンストラクタへのアクセスを提供する。 - scala> val ctor = ru.typeOf[Person].decl(ru.nme.CONSTRUCTOR).asMethod + scala> val ctor = ru.typeOf[Person].decl(ru.termNames.CONSTRUCTOR).asMethod ctor: scala.reflect.runtime.universe.MethodSymbol = constructor Person `Person` のコンストラクタのシンボルは実行時ユニバース `ru` を用いて `Person` 型の宣言から照会することによってのみ得られる。 diff --git a/_ja/overviews/reflection/symbols-trees-types.md b/_ja/overviews/reflection/symbols-trees-types.md index 9b8c1f9871..360c5615f2 100644 --- a/_ja/overviews/reflection/symbols-trees-types.md +++ b/_ja/overviews/reflection/symbols-trees-types.md @@ -428,7 +428,7 @@ Scala リフレクションは、ユニバース経由で構文木を視覚化 生の構文木の内部構造をインスペクトするには以下のように行う: scala> showRaw(tree) - res1: String = Block(List(ClassDef(Modifiers(), TypeName("Flower"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("name"), List(), List(), TypeTree(), Literal(Constant("Rose"))))))), Literal(Constant(()))) + res1: String = Block(List(ClassDef(Modifiers(), TypeName("Flower"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("name"), List(), List(), TypeTree(), Literal(Constant("Rose"))))))), Literal(Constant(()))) ### 構文木の走査 diff --git a/_overviews/reflection/annotations-names-scopes.md b/_overviews/reflection/annotations-names-scopes.md index 9fd4a3c1c7..226c5e5d59 100644 --- a/_overviews/reflection/annotations-names-scopes.md +++ b/_overviews/reflection/annotations-names-scopes.md @@ -100,7 +100,7 @@ convert between strings and term or type names: Certain names, such as "`_root_`", have special meanings in Scala programs. As such they are essential for reflectively accessing certain Scala constructs. For example, reflectively invoking a constructor requires using the -*standard name* `universe.nme.CONSTRUCTOR`, the term name `` which represents the +*standard name* `universe.termNames.CONSTRUCTOR`, the term name `` which represents the constructor name on the JVM. There are both @@ -109,7 +109,7 @@ There are both - *standard type names,* _e.g.,_ "``", "`_`", and "`_*`". Some names, such as "package", exist both as a type name and a term name. -Standard names are made available through the `nme` and `tpnme` members of +Standard names are made available through the `termNames` and `typeNames` members of class `Universe`. For a complete specification of all standard names, see the [API documentation](http://www.scala-lang.org/api/current/scala-reflect/scala/reflect/api/StandardNames.html). @@ -337,9 +337,9 @@ valid Scala code. List(Ident(TypeName("AnyRef"))), emptyValDef, List( - DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List( - Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), + Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("x"), List(), List(), TypeTree(), Literal(Constant(2))))))), @@ -359,9 +359,9 @@ The method `showRaw` can also print `scala.reflect.api.Types` next to the artifa List(Ident[4](TypeName("AnyRef"))), emptyValDef, List( - DefDef[2](Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree[3](), + DefDef[2](Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree[3](), Block[1](List( - Apply[4](Select[5](Super[6](This[3](TypeName("C")), tpnme.EMPTY), ...))), + Apply[4](Select[5](Super[6](This[3](TypeName("C")), typeNames.EMPTY), ...))), Literal[1](Constant(())))), DefDef[2](Modifiers(), TermName("x"), List(), List(), TypeTree[7](), Literal[8](Constant(2))))))), diff --git a/_overviews/reflection/environment-universes-mirrors.md b/_overviews/reflection/environment-universes-mirrors.md index 5159569005..52c51b070a 100644 --- a/_overviews/reflection/environment-universes-mirrors.md +++ b/_overviews/reflection/environment-universes-mirrors.md @@ -153,7 +153,7 @@ A `ClassMirror` is used for creating invoker mirrors for constructors. Entry poi scala> val cm = m.reflectClass(classC) cm: scala.reflect.runtime.universe.ClassMirror = class mirror for C (bound to null) - scala> val ctorC = ru.typeOf[C].decl(ru.nme.CONSTRUCTOR).asMethod + scala> val ctorC = ru.typeOf[C].decl(ru.termNames.CONSTRUCTOR).asMethod ctorC: scala.reflect.runtime.universe.MethodSymbol = constructor C scala> val ctorm = cm.reflectConstructor(ctorC) diff --git a/_overviews/reflection/overview.md b/_overviews/reflection/overview.md index 4ee24167f9..22b267acfa 100644 --- a/_overviews/reflection/overview.md +++ b/_overviews/reflection/overview.md @@ -132,7 +132,7 @@ The second step involves obtaining a `ClassMirror` for class `Person` using the `reflectClass` method. The `ClassMirror` provides access to the constructor of class `Person`. - scala> val ctor = ru.typeOf[Person].decl(ru.nme.CONSTRUCTOR).asMethod + scala> val ctor = ru.typeOf[Person].decl(ru.termNames.CONSTRUCTOR).asMethod ctor: scala.reflect.runtime.universe.MethodSymbol = constructor Person The symbol for `Person`s constructor can be obtained using only the runtime diff --git a/_overviews/reflection/symbols-trees-types.md b/_overviews/reflection/symbols-trees-types.md index 48bd40f180..5a8de3151d 100644 --- a/_overviews/reflection/symbols-trees-types.md +++ b/_overviews/reflection/symbols-trees-types.md @@ -464,7 +464,7 @@ the tree that `expr` contains by: And we can inspect the raw tree by simply doing: scala> showRaw(tree) - res1: String = Block(List(ClassDef(Modifiers(), TypeName("Flower"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("name"), List(), List(), TypeTree(), Literal(Constant("Rose"))))))), Literal(Constant(()))) + res1: String = Block(List(ClassDef(Modifiers(), TypeName("Flower"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(Modifiers(), TermName("name"), List(), List(), TypeTree(), Literal(Constant("Rose"))))))), Literal(Constant(()))) ### Traversing Trees