"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dmd/expressionsem.d" between
dmd-2.094.0.tar.gz and dmd-2.094.1.tar.gz

About: DMD (Digital Mars D) is the D reference compiler. D is an object-oriented, imperative, multi-paradigm system programming language.

expressionsem.d  (dmd-2.094.0):expressionsem.d  (dmd-2.094.1)
skipping to change at line 5191 skipping to change at line 5191
// https://issues.dlang.org/show_bug.cgi?id=18266 // https://issues.dlang.org/show_bug.cgi?id=18266
// set parent so that type semantic does not assert // set parent so that type semantic does not assert
s.parent = sc.parent; s.parent = sc.parent;
Dsymbol originalSymbol = sc.func.localsymtab.lookup(s.ident) ; Dsymbol originalSymbol = sc.func.localsymtab.lookup(s.ident) ;
assert(originalSymbol); assert(originalSymbol);
e.error("declaration `%s` is already defined in another scop e in `%s` at line `%d`", s.toPrettyChars(), sc.func.toChars(), originalSymbol.lo c.linnum); e.error("declaration `%s` is already defined in another scop e in `%s` at line `%d`", s.toPrettyChars(), sc.func.toChars(), originalSymbol.lo c.linnum);
return setError(); return setError();
} }
else else
{ {
/* https://issues.dlang.org/show_bug.cgi?id=21272
* If we are in a foreach body we need to extract the
* function containing the foreach
*/
FuncDeclaration fes_enclosing_func;
if (sc.func && sc.func.fes)
fes_enclosing_func = sc.enclosing.enclosing.func;
// Disallow shadowing // Disallow shadowing
for (Scope* scx = sc.enclosing; scx && (scx.func == sc.func || (scx.func && sc.func.fes)); scx = scx.enclosing) for (Scope* scx = sc.enclosing; scx && (scx.func == sc.func || (fes_enclosing_func && scx.func == fes_enclosing_func)); scx = scx.enclosing)
{ {
Dsymbol s2; Dsymbol s2;
if (scx.scopesym && scx.scopesym.symtab && (s2 = scx.sco pesym.symtab.lookup(s.ident)) !is null && s != s2) if (scx.scopesym && scx.scopesym.symtab && (s2 = scx.sco pesym.symtab.lookup(s.ident)) !is null && s != s2)
{ {
// allow STC.local symbols to be shadowed // allow STC.local symbols to be shadowed
// TODO: not really an optimal design // TODO: not really an optimal design
auto decl = s2.isDeclaration(); auto decl = s2.isDeclaration();
if (!decl || !(decl.storage_class & STC.local)) if (!decl || !(decl.storage_class & STC.local))
{ {
if (sc.func.fes) if (sc.func.fes)
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)