Adjust project code to new labels syntax

This commit is contained in:
Denis Zharkov
2015-04-28 15:43:08 +03:00
parent 1d8786dabf
commit 02659ca22d
18 changed files with 19 additions and 19 deletions
@@ -85,7 +85,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
} }
} }
@signatures signatures@
for ((rawSignature, origins) in groupedBySignature.entrySet()) { for ((rawSignature, origins) in groupedBySignature.entrySet()) {
if (origins.size() <= 1) continue if (origins.size() <= 1) continue
@@ -33,7 +33,7 @@ object PrecedingCommentsBinder : WhitespacesAndCommentsBinder {
// 2. bind plain comments // 2. bind plain comments
var result = tokens.size() var result = tokens.size()
@tokens for (idx in tokens.indices.reversed()) { tokens@ for (idx in tokens.indices.reversed()) {
val tokenType = tokens[idx] val tokenType = tokens[idx]
when (tokenType) { when (tokenType) {
JetTokens.WHITE_SPACE -> if (StringUtil.getLineBreakCount(getter[idx]) > 1) break@tokens JetTokens.WHITE_SPACE -> if (StringUtil.getLineBreakCount(getter[idx]) > 1) break@tokens
@@ -72,7 +72,7 @@ object TrailingCommentsBinder : WhitespacesAndCommentsBinder {
if (tokens.isEmpty()) return 0 if (tokens.isEmpty()) return 0
var result = 0 var result = 0
@tokens for (idx in tokens.indices) { tokens@ for (idx in tokens.indices) {
val tokenType = tokens[idx] val tokenType = tokens[idx]
when (tokenType) { when (tokenType) {
JetTokens.WHITE_SPACE -> if (StringUtil.containsLineBreak(getter[idx])) break@tokens JetTokens.WHITE_SPACE -> if (StringUtil.containsLineBreak(getter[idx])) break@tokens
@@ -71,7 +71,7 @@ object DescriptorEquivalenceForOverrides {
if (!ownersEquivalent(a, b, {x, y -> false})) return false if (!ownersEquivalent(a, b, {x, y -> false})) return false
val overridingUtil = OverridingUtil.createWithEqualityAxioms @eq { val overridingUtil = OverridingUtil.createWithEqualityAxioms eq@ {
c1, c2 -> c1, c2 ->
if (c1 == c2) return@eq true if (c1 == c2) return@eq true
@@ -46,7 +46,7 @@ public class LazyJavaPackageFragmentProvider(
else null else null
} }
private val topLevelClasses = c.storageManager.createMemoizedFunctionWithNullableValues @lambda { private val topLevelClasses = c.storageManager.createMemoizedFunctionWithNullableValues lambda@ {
jClass: JavaClass -> jClass: JavaClass ->
val fqName = jClass.getFqName() val fqName = jClass.getFqName()
if (fqName == null) return@lambda null if (fqName == null) return@lambda null
@@ -268,7 +268,7 @@ class LazyJavaTypeResolver(
return (descriptor as ClassDescriptor).getMemberScope(getArguments()) return (descriptor as ClassDescriptor).getMemberScope(getArguments())
} }
private val nullable = c.storageManager.createLazyValue @l { private val nullable = c.storageManager.createLazyValue l@ {
when (attr.flexibility) { when (attr.flexibility) {
FLEXIBLE_LOWER_BOUND -> return@l false FLEXIBLE_LOWER_BOUND -> return@l false
FLEXIBLE_UPPER_BOUND -> return@l true FLEXIBLE_UPPER_BOUND -> return@l true
@@ -136,7 +136,7 @@ public fun interpreterLoop(
} }
try { try {
@loop while (true) { loop@ while (true) {
val insnOpcode = currentInsn.getOpcode() val insnOpcode = currentInsn.getOpcode()
val insnType = currentInsn.getType() val insnType = currentInsn.getType()
@@ -56,7 +56,7 @@ fun suite(): TestSuite {
Thread { Thread {
val eventQueue = vm.eventQueue() val eventQueue = vm.eventQueue()
@mainLoop while (true) { mainLoop@ while (true) {
val eventSet = eventQueue.remove() val eventSet = eventQueue.remove()
for (event in eventSet.eventIterator()) { for (event in eventSet.eventIterator()) {
when (event) { when (event) {
@@ -90,7 +90,7 @@ private fun getModuleInfoByVirtualFile(project: Project, virtualFile: VirtualFil
val orderEntries = projectFileIndex.getOrderEntriesForFile(virtualFile) val orderEntries = projectFileIndex.getOrderEntriesForFile(virtualFile)
@entries for (orderEntry in orderEntries) { entries@ for (orderEntry in orderEntries) {
when (orderEntry) { when (orderEntry) {
is LibraryOrderEntry -> { is LibraryOrderEntry -> {
val library = orderEntry.getLibrary() ?: continue@entries val library = orderEntry.getLibrary() ?: continue@entries
@@ -299,7 +299,7 @@ private fun createKeywordWithLabelElement(keyword: String, label: String?): Look
fun breakOrContinueExpressionItems(position: JetElement, breakOrContinue: String): Collection<LookupElement> { fun breakOrContinueExpressionItems(position: JetElement, breakOrContinue: String): Collection<LookupElement> {
val result = ArrayList<LookupElement>() val result = ArrayList<LookupElement>()
@parentsLoop parentsLoop@
for (parent in position.parents()) { for (parent in position.parents()) {
when (parent) { when (parent) {
is JetLoopExpression -> { is JetLoopExpression -> {
@@ -57,7 +57,7 @@ public class SyntheticKotlinBlock(
var child = subBlocks.first() var child = subBlocks.first()
var treeNode: ASTNode? = null var treeNode: ASTNode? = null
@loop loop@
while (treeNode == null) when (child) { while (treeNode == null) when (child) {
is AbstractBlock -> { is AbstractBlock -> {
treeNode = (child as AbstractBlock).getNode() treeNode = (child as AbstractBlock).getNode()
@@ -505,7 +505,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
var lineBreaksPresent: Int = 0 var lineBreaksPresent: Int = 0
var neighbor: PsiElement? = null var neighbor: PsiElement? = null
@siblingsLoop siblingsLoop@
for (sibling in decl.siblings(forward = after, withItself = false)) { for (sibling in decl.siblings(forward = after, withItself = false)) {
when (sibling) { when (sibling) {
is PsiWhiteSpace -> lineBreaksPresent += (sibling.getText() ?: "").count { it == '\n' } is PsiWhiteSpace -> lineBreaksPresent += (sibling.getText() ?: "").count { it == '\n' }
@@ -91,7 +91,7 @@ public fun processDuplicates(
var showAll = false var showAll = false
@duplicateReplacersLoop duplicateReplacersLoop@
for ((i, entry) in duplicateReplacers.entrySet().withIndex()) { for ((i, entry) in duplicateReplacers.entrySet().withIndex()) {
val (pattern, replacer) = entry val (pattern, replacer) = entry
if (!pattern.isValid()) continue if (!pattern.isValid()) continue
@@ -159,7 +159,7 @@ fun ExtractableCodeDescriptor.findDuplicates(): List<DuplicateInfo> {
if (valueCount == 1) { if (valueCount == 1) {
matchValues(controlFlow.outputValues.first(), newControlFlow.outputValues.first()) matchValues(controlFlow.outputValues.first(), newControlFlow.outputValues.first())
} else { } else {
@outer outer@
for (currentValue in controlFlow.outputValues) for (currentValue in controlFlow.outputValues)
for (newValue in newControlFlow.outputValues) { for (newValue in newControlFlow.outputValues) {
if ((currentValue is ExpressionValue) != (newValue is ExpressionValue)) continue if ((currentValue is ExpressionValue) != (newValue is ExpressionValue)) continue
@@ -608,7 +608,7 @@ public class JetPsiUnifier(
val delegationInfo2 = getDelegationOrderInfo(decl2) val delegationInfo2 = getDelegationOrderInfo(decl2)
if (delegationInfo1.orderInsensitive.size() != delegationInfo2.orderInsensitive.size()) return UNMATCHED if (delegationInfo1.orderInsensitive.size() != delegationInfo2.orderInsensitive.size()) return UNMATCHED
@outer outer@
for (specifier1 in delegationInfo1.orderInsensitive) { for (specifier1 in delegationInfo1.orderInsensitive) {
for (specifier2 in delegationInfo2.orderInsensitive) { for (specifier2 in delegationInfo2.orderInsensitive) {
if (doUnify(specifier1, specifier2) != UNMATCHED) continue@outer if (doUnify(specifier1, specifier2) != UNMATCHED) continue@outer
@@ -34,7 +34,7 @@ object DocCommentConverter {
val html = StringBuilder { val html = StringBuilder {
appendJavadocElements(docComment.getDescriptionElements()) appendJavadocElements(docComment.getDescriptionElements())
@tagsLoop tagsLoop@
for (tag in docComment.getTags()) { for (tag in docComment.getTags()) {
when (tag.getName()) { when (tag.getName()) {
"deprecated" -> continue@tagsLoop "deprecated" -> continue@tagsLoop
@@ -255,7 +255,7 @@ public class JavaToKotlinConverter(private val project: Project,
private fun processUsages(refs: Collection<ReferenceInfo>) { private fun processUsages(refs: Collection<ReferenceInfo>) {
for (fileRefs in refs.groupBy { it.file }.values()) { // group by file for faster sorting for (fileRefs in refs.groupBy { it.file }.values()) { // group by file for faster sorting
@ReferenceLoop ReferenceLoop@
for ((reference, target, file, processings) in fileRefs.sortBy(ReferenceComparator)) { for ((reference, target, file, processings) in fileRefs.sortBy(ReferenceComparator)) {
val processors = when (reference.getElement().getLanguage()) { val processors = when (reference.getElement().getLanguage()) {
JavaLanguage.INSTANCE -> processings.map { it.javaCodeProcessor }.filterNotNull() JavaLanguage.INSTANCE -> processings.map { it.javaCodeProcessor }.filterNotNull()
@@ -145,7 +145,7 @@ class OverloadReducer(
.map { it.key } .map { it.key }
.sortBy { -it.getParameterList().getParametersCount() } // we will try to drop them starting from ones with more parameters .sortBy { -it.getParameterList().getParametersCount() } // we will try to drop them starting from ones with more parameters
@DropCandidatesLoop DropCandidatesLoop@
for (method in dropCandidates) { for (method in dropCandidates) {
val paramCount = method.getParameterList().getParametersCount() val paramCount = method.getParameterList().getParametersCount()
val targetInfo = equivalenceMap[method]!! val targetInfo = equivalenceMap[method]!!
@@ -44,7 +44,7 @@ public fun getSimpleName(call: JsInvocation): JsName? {
public fun getSimpleIdent(call: JsInvocation): String? { public fun getSimpleIdent(call: JsInvocation): String? {
var qualifier: JsExpression? = call.getQualifier() var qualifier: JsExpression? = call.getQualifier()
@qualifiers while (qualifier != null) { qualifiers@ while (qualifier != null) {
when (qualifier) { when (qualifier) {
is JsInvocation -> { is JsInvocation -> {
val callableQualifier = qualifier as JsInvocation val callableQualifier = qualifier as JsInvocation