From 1fc4573a8c3e595c82404413ca8f9daf10e4bae5 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 4 Mar 2014 19:07:45 +0400 Subject: [PATCH] removed duplication of pseudocode in tests for local functions --- .../testData/cfg/basic/Basic.instructions | 10 ---- .../controlStructures/Finally.instructions | 58 ------------------- .../unusedFunctionLiteral.instructions | 10 ---- .../local/LocalDeclarations.instructions | 44 -------------- .../local/localClass.instructions | 42 -------------- .../local/localProperty.instructions | 12 ---- .../jet/cfg/AbstractControlFlowTest.java | 8 --- 7 files changed, 184 deletions(-) diff --git a/compiler/testData/cfg/basic/Basic.instructions b/compiler/testData/cfg/basic/Basic.instructions index a8f188b5085..78c33ef25b7 100644 --- a/compiler/testData/cfg/basic/Basic.instructions +++ b/compiler/testData/cfg/basic/Basic.instructions @@ -70,16 +70,6 @@ error: PREV:[] sink: PREV:[, , d({1})] -L3: - - mark(1) - r(1) -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == anonymous_0 == {1} diff --git a/compiler/testData/cfg/controlStructures/Finally.instructions b/compiler/testData/cfg/controlStructures/Finally.instructions index 53be85641cb..d77ef767b47 100644 --- a/compiler/testData/cfg/controlStructures/Finally.instructions +++ b/compiler/testData/cfg/controlStructures/Finally.instructions @@ -124,27 +124,6 @@ error: PREV:[jmp(error)] sink: PREV:[, , d({ () -> if (2 > 3) { return@ } })] -L4: - - mark(if (2 > 3) { return@ }) - mark(if (2 > 3) { return@ }) - mark(2 > 3) - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), mark({ return@ })] - mark({ return@ }) - ret L5 NEXT:[] -- jmp(L7) NEXT:[] PREV:[] -L6: - read (Unit) PREV:[jf(L6)] -L5: -L7: - NEXT:[] PREV:[ret L5, read (Unit)] -error: - PREV:[] -sink: - PREV:[, ] ===================== == anonymous_0 == { () -> @@ -204,43 +183,6 @@ error: PREV:[] sink: PREV:[, , d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } })] -L3: - - mark(try { 1 if (2 > 3) { return@ } } finally { 2 }) - mark(try { 1 if (2 > 3) { return@ } } finally { 2 }) - jmp?(L5 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { return@ } })] - mark({ 1 if (2 > 3) { return@ } }) - r(1) - mark(if (2 > 3) { return@ }) - mark(2 > 3) - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), mark({ return@ })] - mark({ return@ }) -L7 [start finally]: - mark({ 2 }) - r(2) -L8 [finish finally]: - ret L4 NEXT:[] -- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] -L6: - read (Unit) PREV:[jf(L6)] -L9: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] -L5 [onExceptionToFinallyBlock]: - mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] - r(2) - jmp(error) NEXT:[] -L10 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] - r(2) -L4: - NEXT:[] PREV:[ret L4, r(2)] -error: - PREV:[jmp(error)] -sink: - PREV:[, ] ===================== == anonymous_1 == { () -> diff --git a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions index 719d5715e21..c86ac76da0a 100644 --- a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions +++ b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions @@ -17,16 +17,6 @@ error: PREV:[] sink: PREV:[, , d({})] -L3: - - mark() - read (Unit) -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == anonymous_0 == {} diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions index e42e1a00f60..0249c69a987 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions @@ -149,17 +149,6 @@ error: PREV:[] sink: PREV:[, , d(fun inner_bar() { y = 10 })] -L3: - - mark({ y = 10 }) - r(10) - w(y) -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == inner_bar == fun inner_bar() { @@ -213,17 +202,6 @@ error: PREV:[] sink: PREV:[, , d(fun ggg() { y = 10 })] -L3: - - mark({ y = 10 }) - r(10) - w(y) -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == ggg == fun ggg() { @@ -283,28 +261,6 @@ error: PREV:[] sink: PREV:[, , d(fun foo() { x = 3 }), d(fun bar() { x = 4 })] -L3: - - mark({ x = 3 }) - r(3) - w(x) -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] -L6: - - mark({ x = 4 }) - r(4) - w(x) -L7: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == foo == fun foo() { diff --git a/compiler/testData/cfg/declarations/local/localClass.instructions b/compiler/testData/cfg/declarations/local/localClass.instructions index 394341737f9..d822caf23c5 100644 --- a/compiler/testData/cfg/declarations/local/localClass.instructions +++ b/compiler/testData/cfg/declarations/local/localClass.instructions @@ -23,35 +23,6 @@ error: PREV:[] sink: PREV:[, , d(fun f() { val x = "" fun loc() { val x3 = "" } })] -L3: - - mark({ val x = "" fun loc() { val x3 = "" } }) - v(val x = "") - mark("") - r("") - w(x) - jmp?(L5) NEXT:[, d(fun loc() { val x3 = "" })] - d(fun loc() { val x3 = "" }) NEXT:[] -L4: -L5: - NEXT:[] PREV:[jmp?(L5)] -error: - PREV:[] -sink: - PREV:[, , d(fun loc() { val x3 = "" })] -L6: - - mark({ val x3 = "" }) - v(val x3 = "") - mark("") - r("") - w(x3) -L7: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == f == fun f() { @@ -78,19 +49,6 @@ error: PREV:[] sink: PREV:[, , d(fun loc() { val x3 = "" })] -L6: - - mark({ val x3 = "" }) - v(val x3 = "") - mark("") - r("") - w(x3) -L7: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == loc == fun loc() { diff --git a/compiler/testData/cfg/declarations/local/localProperty.instructions b/compiler/testData/cfg/declarations/local/localProperty.instructions index 5c20804013e..51e8d451364 100644 --- a/compiler/testData/cfg/declarations/local/localProperty.instructions +++ b/compiler/testData/cfg/declarations/local/localProperty.instructions @@ -22,18 +22,6 @@ error: PREV:[] sink: PREV:[, , d(get() { val b: Int return b })] -L3: - - mark({ val b: Int return b }) - v(val b: Int) - r(b) - ret(*) L4 -L4: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] ===================== == get_a == get() { diff --git a/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java b/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java index 7d1b5ae2b8b..937243c1eb3 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java +++ b/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java @@ -211,7 +211,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment List instructions = pseudocode.getAllInstructions(); Set remainedAfterPostProcessInstructions = Sets.newHashSet(pseudocode.getInstructions()); List labels = pseudocode.getLabels(); - List locals = new ArrayList(); int maxLength = 0; int maxNextLength = 0; for (Instruction instruction : instructions) { @@ -238,10 +237,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment } for (int i = 0; i < instructions.size(); i++) { Instruction instruction = instructions.get(i); - if (instruction instanceof LocalFunctionDeclarationInstruction) { - LocalFunctionDeclarationInstruction localFunctionDeclarationInstruction = (LocalFunctionDeclarationInstruction) instruction; - locals.add((PseudocodeImpl) localFunctionDeclarationInstruction.getBody()); - } for (PseudocodeImpl.PseudocodeLabel label: labels) { if (label.getTargetInstructionIndex() == i) { out.append(label.getName()).append(":\n"); @@ -267,9 +262,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment out.append(StringUtil.trimTrailing(line.toString())); out.append("\n"); } - for (PseudocodeImpl local : locals) { - dumpInstructions(local, out); - } } private static boolean sameContents(@Nullable Instruction natural, Collection actual) {