diff --git a/runtime/src/main/kotlin/konan/concurrent.kt b/runtime/src/main/kotlin/konan/concurrent.kt new file mode 100644 index 00000000000..f5cb1b9ecfc --- /dev/null +++ b/runtime/src/main/kotlin/konan/concurrent.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlin + +// Note: +// Right now we don't want to have neither 'volatile' nor 'synchronized' at runtime. + +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) +@Retention(AnnotationRetention.SOURCE) +public annotation class Volatile + +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) +@Retention(AnnotationRetention.SOURCE) +public annotation class Synchronized + +@kotlin.internal.InlineOnly +public inline fun synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, crossinline block: () -> R): R = block() \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/Annotations.kt b/runtime/src/main/kotlin/kotlin/Annotations.kt index a7d057fb019..117229298a8 100644 --- a/runtime/src/main/kotlin/kotlin/Annotations.kt +++ b/runtime/src/main/kotlin/kotlin/Annotations.kt @@ -108,6 +108,25 @@ public annotation class UnsafeVariance @MustBeDocumented public annotation class SinceKotlin(val version: String) +/** + * When applied to annotation class X specifies that X defines a DSL language + * + * The general rule: + * - an implicit receiver may *belong to a DSL @X* if marked with a corresponding DSL marker annotation + * - two implicit receivers of the same DSL are not accessible in the same scope + * - the closest one wins + * - other available receivers are resolved as usual, but if the resulting resolved call binds to such a receiver, it's a compilation error + * + * Marking rules: an implicit receiver is considered marked with @Ann if + * - its type is marked, or + * - its type's classifier is marked + * - or any of its superclasses/superinterfaces + */ +@Target(ANNOTATION_CLASS) +@Retention(BINARY) +@MustBeDocumented +@SinceKotlin("1.1") +public annotation class DslMarker /** * Specifies that this part of internal API is effectively public exposed by using in public inline function