[Issue 5184] throw ClassName.templatedStaticMethod(...) cannot be parsed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 9 02:14:52 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5184



--- Comment #1 from Kazuhiro Inaba <kiki at kmonos.net> 2011-04-09 02:10:36 PDT ---
Created an attachment (id=941)
A patch to fix the issue

What was happening was:

1. Factory.create(123) is desugared into CommaExp: (Factory,
Factory.create(123)).
   This is done in CallExp::semantic when the method is static template method.
   I'm not at all sure but is this for keeping side-effects for some cases?

2. In e2ir.c TypeExp::toElem emits the compilation error; it tries to compile
   lhs and rhs into IR, but TypeExp cannot be compiled to IR.

The patch modifies the first point. If the expression is "TYPE . SOMETHING",
the CommaExp insertion is disabled.

FYI, the problematic error is issued only inside ThrowStatement, because
in ThrowStatement::semantic, exp->optimize() is not called.
In, e.g., ReturnStatement::semantic optimizes away the TypeExp before toIR
convertion, so it won't cause any problem. (I don't know the reason why.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list