mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Fixed Bug 85820 - [Length] should IASTInitializerList's length be included in the length of it's parents?
This commit is contained in:
parent
54791bce99
commit
7918ac34f0
2 changed files with 9 additions and 1 deletions
|
@ -440,4 +440,12 @@ public class DOMLocationTests extends AST2BaseTest {
|
||||||
assertSoleLocation( endif, code.indexOf( "#endif"), "#endif".length() ); //$NON-NLS-1$ //$NON-NLS-2$
|
assertSoleLocation( endif, code.indexOf( "#endif"), "#endif".length() ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug85820() throws Exception {
|
||||||
|
String code = "int *p = (int []){2, 4};"; //$NON-NLS-1$
|
||||||
|
IASTTranslationUnit tu = parse( code, ParserLanguage.C );
|
||||||
|
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
||||||
|
IASTDeclarator d = sd.getDeclarators()[0];
|
||||||
|
assertSoleLocation( d, code.indexOf("*p = (int []){2, 4}"), "*p = (int []){2, 4}".length() ); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -916,7 +916,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||||
IASTInitializer i = cInitializerClause(Collections.EMPTY_LIST);
|
IASTInitializer i = cInitializerClause(Collections.EMPTY_LIST);
|
||||||
firstExpression = buildTypeIdInitializerExpression(t, i,
|
firstExpression = buildTypeIdInitializerExpression(t, i,
|
||||||
offset, lastOffset);
|
offset, calculateEndOffset(i));
|
||||||
break;
|
break;
|
||||||
} catch (BacktrackException bt) {
|
} catch (BacktrackException bt) {
|
||||||
backup(m);
|
backup(m);
|
||||||
|
|
Loading…
Add table
Reference in a new issue