Is all well with org.eclipse.jdt.internal.compiler.ast.SwitchStatement.statementGenerateCode(BlockScope, CodeStream, Statement) ? #3277
Replies: 4 comments
-
@mpalat @stephan-herrmann - any insights are welcome |
Beta Was this translation helpful? Give feedback.
-
BTW, this may not be tightly coupled with patterns. This program which doesn't use patterns also triggers a compiler assert:
|
Beta Was this translation helpful? Give feedback.
-
OK. I have understood the problem, the switch in scope inside the method compensates for the call site not being corrected to use |
Beta Was this translation helpful? Give feedback.
-
Manoj confirmed in another thread that this was an inadvertent slip up. Restoring here: #3280 |
Beta Was this translation helpful? Give feedback.
-
(1) This method swaps the Scope involved at the call site and changes it to
this.scope
- I am not sure if this intentional or inadvertent.If I eliminate call to here from
org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCodeForStringSwitch(BlockScope, CodeStream)
i.e change this line
statementGenerateCode(currentScope, codeStream, statement);
into
statement.generateCode(currentScope, codeStream);
we have a failure in
org.eclipse.jdt.core.tests.compiler.regression.InstanceofPrimaryPatternTest.test577415_7()
I am wondering if this change in scope is somehow masking a problem elsewhere.
Does anyone understand what exactly this method does ? Why won't we call
statement.generateCode(currentScope, codeStream)
BTW, its override in SwitchExpressions was causing #3276 and was removed by #3272
(2) The diagnostic call
this.scope.problemReporter().operandStackSizeInappropriate(this)
inorg.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(ClassFile)
has been commented out. Why ??This sanity check has found so many problems so far - I don't know of a case where it issues an inappropriate message.
If it indeed does, then let us discuss the scenario.
Beta Was this translation helpful? Give feedback.
All reactions