"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dmd/parse.d" between
dmd-2.097.0.tar.gz and dmd-2.097.1.tar.gz

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

parse.d  (dmd-2.097.0):parse.d  (dmd-2.097.1)
skipping to change at line 3115 skipping to change at line 3115
id = token.ident; id = token.ident;
nextToken(); nextToken();
} }
memtype = null; memtype = null;
if (token.value == TOK.colon) if (token.value == TOK.colon)
{ {
nextToken(); nextToken();
int alt = 0; int alt = 0;
const typeLoc = token.loc; const typeLoc = token.loc;
Identifier ident;
memtype = parseBasicType(); memtype = parseBasicType();
memtype = parseDeclarator(memtype, alt, ident); memtype = parseDeclarator(memtype, alt, null);
if (ident) checkCstyleTypeSyntax(typeLoc, memtype, alt, null);
error("unexpected identifier `%s` in declarator", ident.toChars(
));
checkCstyleTypeSyntax(typeLoc, memtype, alt, ident);
} }
e = new AST.EnumDeclaration(loc, id, memtype); e = new AST.EnumDeclaration(loc, id, memtype);
if (token.value == TOK.semicolon && id) if (token.value == TOK.semicolon && id)
nextToken(); nextToken();
else if (token.value == TOK.leftCurly) else if (token.value == TOK.leftCurly)
{ {
bool isAnonymousEnum = !id; bool isAnonymousEnum = !id;
TOK prevTOK; TOK prevTOK;
skipping to change at line 3614 skipping to change at line 3611
} }
break; break;
} }
const typeLoc = token.loc; const typeLoc = token.loc;
AST.Type t; AST.Type t;
t = parseBasicType(); t = parseBasicType();
int alt = 0; int alt = 0;
Identifier ident; t = parseDeclarator(t, alt, pident, ptpl);
t = parseDeclarator(t, alt, ident, ptpl); checkCstyleTypeSyntax(typeLoc, t, alt, pident ? *pident : null);
checkCstyleTypeSyntax(typeLoc, t, alt, ident);
if (pident)
*pident = ident;
t = t.addSTC(stc); t = t.addSTC(stc);
return t; return t;
} }
private AST.Type parseBasicType(bool dontLookDotIdents = false) private AST.Type parseBasicType(bool dontLookDotIdents = false)
{ {
AST.Type t; AST.Type t;
Loc loc; Loc loc;
Identifier id; Identifier id;
skipping to change at line 4089 skipping to change at line 4083
* 2 for C-style array declaration syntax, otherwise don't m odify * 2 for C-style array declaration syntax, otherwise don't m odify
* pident = set to Identifier if there is one, null if not * pident = set to Identifier if there is one, null if not
* tpl = if !null, then set to TemplateParameterList * tpl = if !null, then set to TemplateParameterList
* storageClass = any storage classes seen so far * storageClass = any storage classes seen so far
* pdisable = set to true if @disable seen * pdisable = set to true if @disable seen
* pudas = any user defined attributes seen so far. Merged with any more found * pudas = any user defined attributes seen so far. Merged with any more found
* Returns: * Returns:
* type declared * type declared
* Reference: https://dlang.org/spec/declaration.html#Declarator * Reference: https://dlang.org/spec/declaration.html#Declarator
*/ */
private AST.Type parseDeclarator(AST.Type t, ref int palt, out Identifier pi dent, private AST.Type parseDeclarator(AST.Type t, ref int palt, Identifier* piden t,
AST.TemplateParameters** tpl = null, StorageClass storageClass = 0, AST.TemplateParameters** tpl = null, StorageClass storageClass = 0,
bool* pdisable = null, AST.Expressions** pudas = null) bool* pdisable = null, AST.Expressions** pudas = null)
{ {
//printf("parseDeclarator(tpl = %p)\n", tpl); //printf("parseDeclarator(tpl = %p)\n", tpl);
t = parseTypeSuffixes(t); t = parseTypeSuffixes(t);
AST.Type ts; AST.Type ts;
switch (token.value) switch (token.value)
{ {
case TOK.identifier: case TOK.identifier:
pident = token.ident; if (pident)
*pident = token.ident;
else
error("unexpected identifier `%s` in declarator", token.ident.to
Chars());
ts = t; ts = t;
nextToken(); nextToken();
break; break;
case TOK.leftParenthesis: case TOK.leftParenthesis:
{ {
// like: T (*fp)(); // like: T (*fp)();
// like: T ((*fp))(); // like: T ((*fp))();
if (peekNext() == TOK.mul || peekNext() == TOK.leftParenthesis) if (peekNext() == TOK.mul || peekNext() == TOK.leftParenthesis)
{ {
skipping to change at line 4796 skipping to change at line 4793
while (1) while (1)
{ {
AST.TemplateParameters* tpl = null; AST.TemplateParameters* tpl = null;
bool disable; bool disable;
int alt = 0; int alt = 0;
const loc = token.loc; const loc = token.loc;
Identifier ident; Identifier ident;
auto t = parseDeclarator(ts, alt, ident, &tpl, storage_class, &disab le, &udas); auto t = parseDeclarator(ts, alt, &ident, &tpl, storage_class, &disa ble, &udas);
assert(t); assert(t);
if (!tfirst) if (!tfirst)
tfirst = t; tfirst = t;
else if (t != tfirst) else if (t != tfirst)
error("multiple declarations must have the same type, not `%s` a nd `%s`", tfirst.toChars(), t.toChars()); error("multiple declarations must have the same type, not `%s` a nd `%s`", tfirst.toChars(), t.toChars());
bool isThis = (t.ty == AST.Tident && (cast(AST.TypeIdentifier)t).ide nt == Id.This && token.value == TOK.assign); bool isThis = (t.ty == AST.Tident && (cast(AST.TypeIdentifier)t).ide nt == Id.This && token.value == TOK.assign);
if (ident) if (ident)
checkCstyleTypeSyntax(loc, t, alt, ident); checkCstyleTypeSyntax(loc, t, alt, ident);
else if (!isThis && (t != AST.Type.terror)) else if (!isThis && (t != AST.Type.terror))
skipping to change at line 6233 skipping to change at line 6230
while (token.value != TOK.case_ && token.value != TOK.defaul t_ && token.value != TOK.endOfFile && token.value != TOK.rightCurly) while (token.value != TOK.case_ && token.value != TOK.defaul t_ && token.value != TOK.endOfFile && token.value != TOK.rightCurly)
{ {
auto cur = parseStatement(ParseStatementFlags.semi | Par seStatementFlags.curlyScope); auto cur = parseStatement(ParseStatementFlags.semi | Par seStatementFlags.curlyScope);
statements.push(cur); statements.push(cur);
// https://issues.dlang.org/show_bug.cgi?id=21739 // https://issues.dlang.org/show_bug.cgi?id=21739
// Stop at the last break s.t. the following non-case st atements are // Stop at the last break s.t. the following non-case st atements are
// not merged into the current case. This can happen for // not merged into the current case. This can happen for
// case 1: ... break; // case 1: ... break;
// debug { case 2: ... } // debug { case 2: ... }
if (cur.isBreakStatement()) if (cur && cur.isBreakStatement())
break; break;
} }
s = new AST.CompoundStatement(loc, statements); s = new AST.CompoundStatement(loc, statements);
} }
else else
{ {
s = parseStatement(ParseStatementFlags.semi); s = parseStatement(ParseStatementFlags.semi);
} }
s = new AST.ScopeStatement(loc, s, token.loc); s = new AST.ScopeStatement(loc, s, token.loc);
 End of changes. 7 change blocks. 
15 lines changed or deleted 12 lines changed or added

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