Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 400453

Summary: [xbase] Allow fall-through in switch expression
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: anton, jan, st.oehme, sven.efftinge
Version: 2.4.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: v2.6
Bug Depends on:    
Bug Blocks: 400096    

Description Sebastian Zarnekow CLA 2013-02-11 09:37:21 EST
see bug 400096
Comment 1 Sven Efftinge CLA 2014-02-03 10:33:32 EST
The idea is to allow to write something like this:


  switch foo : someExpression {
     MyType case foo.someOp()
     OtherType case foo.other : someOtherExpression;
  }

Where someOtherExpression is evaluated when either foo matches 

  MyType case foo.someOp()
or 
  OtherType case foo.other
Comment 2 Jan Koehnlein CLA 2014-02-03 10:59:37 EST
We need some separator other than colon ':' as it'd cause ambiguities:

// without separator
B 
case A: 
   foo;
// same as 
// B case A: foo;
// which is AND and not the expected OR


// with colon as separator
A case b:
C case d:
   foo;
// same as 
// A case b: C;
// case d: foo;

I propose to use comma ',' to separate the guards.
Comment 3 Anton Kosyakov CLA 2014-02-04 11:00:14 EST
pushed to review: https://git.eclipse.org/r/#/c/21517/