Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'spec1119'
Browse files Browse the repository at this point in the history
Update for ceylon/ceylon-spec#1119: Inline variable in switch.
  • Loading branch information
lucaswerkmeister committed Nov 19, 2014
2 parents cc42a41 + 87a3619 commit 6fb7bfc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/ceylon/formatter/FormattingVisitor.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ shared class FormattingVisitor(
indentAfter = 1;
lineBreaksAfter = noLineBreak;
};
that.expression.visit(this);
that.switched.visit(this);
fWriter.writeToken {
")"; // not in the AST as well
context;
Expand Down
6 changes: 6 additions & 0 deletions test-samples/switch.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ void testSwitchWithMultipleCases() {
// do other stuff
}
}

void testSwitchWithNewVariable() {
switch (arg = process.arguments.first)
case (is String) { print("Hello, ``arg``!"); }
case (null) { print("USAGE: ceylon run `` `module`.name ``/`` `module`.version `` [NAME]"); }
}
6 changes: 6 additions & 0 deletions test-samples/switch.ceylon.formatted
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ void testSwitchWithMultipleCases() {
// do other stuff
}
}

void testSwitchWithNewVariable() {
switch (arg = process.arguments.first)
case (is String) { print("Hello, ``arg``!"); }
case (null) { print("USAGE: ceylon run `` `module`.name ``/`` `module`.version `` [NAME]"); }
}

0 comments on commit 6fb7bfc

Please sign in to comment.