Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
f4d63158
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f4d63158
编写于
7月 10, 2017
作者:
D
Dmitry Petrov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Take into account JvmName annotation when generating accessors
#KT-17444 Fixed Target versions 1.1.5
上级
efb6756c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
2 deletion
+51
-2
compiler/backend/src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt
...src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt
+6
-2
compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt
...ata/codegen/box/syntheticAccessors/jvmNameForAccessors.kt
+15
-0
compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java
...ins/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java
+6
-0
compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java
...etbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java
+6
-0
compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
...brains/kotlin/codegen/LightAnalysisModeTestGenerated.java
+6
-0
js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java
...s/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java
+12
-0
未找到文件。
compiler/backend/src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt
浏览文件 @
f4d63158
...
...
@@ -17,6 +17,7 @@
package
org.jetbrains.kotlin.codegen
import
org.jetbrains.kotlin.descriptors.*
import
org.jetbrains.kotlin.resolve.DescriptorUtils
enum
class
FieldAccessorKind
(
val
suffix
:
String
)
{
NORMAL
(
"p"
),
...
...
@@ -26,15 +27,18 @@ enum class FieldAccessorKind(val suffix: String) {
override
fun
toString
()
=
suffix
}
private
fun
CallableMemberDescriptor
.
getJvmName
()
=
DescriptorUtils
.
getJvmName
(
this
)
?:
name
.
asString
()
fun
getAccessorNameSuffix
(
descriptor
:
CallableMemberDescriptor
,
superCallDescriptor
:
ClassDescriptor
?,
accessorKind
:
FieldAccessorKind
):
String
{
val
suffix
=
when
(
descriptor
)
{
is
ConstructorDescriptor
->
return
"will be ignored"
is
SimpleFunctionDescriptor
->
descriptor
.
name
.
asString
()
descriptor
.
getJvmName
()
is
PropertyDescriptor
->
descriptor
.
name
.
asString
()
+
"$"
+
accessorKind
descriptor
.
getJvmName
()
+
"$"
+
accessorKind
else
->
throw
UnsupportedOperationException
(
"Do not know how to create accessor for descriptor "
+
descriptor
)
}
...
...
compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt
0 → 100644
浏览文件 @
f4d63158
// IGNORE_BACKEND: JS, NATIVE
// WITH_RUNTIME
@JvmName
(
"fooA"
)
private
fun
String
.
foo
(
t
:
String
?):
String
=
this
private
fun
String
.
foo
(
t
:
String
):
String
=
this
fun
runNoInline
(
fn
:
()
->
String
)
=
fn
()
fun
box
()
=
runNoInline
{
"O"
.
foo
(
""
)
}
+
runNoInline
{
"K"
.
foo
(
null
)
}
compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java
浏览文件 @
f4d63158
...
...
@@ -18029,6 +18029,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/syntheticAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("jvmNameForAccessors.kt")
public void testJvmNameForAccessors() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt");
doTest(fileName);
}
@TestMetadata("kt10047.kt")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/kt10047.kt");
...
...
compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java
浏览文件 @
f4d63158
...
...
@@ -18029,6 +18029,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/syntheticAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("jvmNameForAccessors.kt")
public void testJvmNameForAccessors() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt");
doTest(fileName);
}
@TestMetadata("kt10047.kt")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/kt10047.kt");
...
...
compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
浏览文件 @
f4d63158
...
...
@@ -18029,6 +18029,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/syntheticAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("jvmNameForAccessors.kt")
public void testJvmNameForAccessors() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt");
doTest(fileName);
}
@TestMetadata("kt10047.kt")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/kt10047.kt");
...
...
js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java
浏览文件 @
f4d63158
...
...
@@ -22103,6 +22103,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/syntheticAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("jvmNameForAccessors.kt")
public void testJvmNameForAccessors() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/jvmNameForAccessors.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("kt10047.kt")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/syntheticAccessors/kt10047.kt");
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录