Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 184715 Details for
Bug 331985
Failing refactoring test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix and test case for Markus's example
331985.txt (text/plain), 4.14 KB, created by
Emanuel Graf
on 2010-12-07 08:24:03 EST
(
hide
)
Description:
Fix and test case for Markus's example
Filename:
MIME Type:
Creator:
Emanuel Graf
Created:
2010-12-07 08:24:03 EST
Size:
4.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui >Index: src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java,v >retrieving revision 1.13 >diff -u -r1.13 ExtractExpression.java >--- src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java 20 Oct 2009 10:18:59 -0000 1.13 >+++ src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java 7 Dec 2010 13:22:51 -0000 >@@ -26,10 +26,11 @@ > import org.eclipse.cdt.core.dom.ast.IASTNode; > import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier; > import org.eclipse.cdt.core.dom.ast.IBasicType; >+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; > import org.eclipse.cdt.core.dom.ast.IBinding; > import org.eclipse.cdt.core.dom.ast.IType; > import org.eclipse.cdt.core.dom.ast.ITypedef; >-import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; >+import org.eclipse.cdt.core.dom.ast.IVariable; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; >@@ -188,7 +189,7 @@ > if(ret != null) return ret; > }else { > if(node.getOperand1() instanceof CPPASTIdExpression) { >- return getBinaryExpressionType(((CPPASTIdExpression) node.getOperand1()).getExpressionType()); >+ return getBinaryExpressionType((CPPASTIdExpression) node.getOperand1()); > } > } > >@@ -197,24 +198,38 @@ > if(ret != null) return ret; > }else { > if(node.getOperand2() instanceof CPPASTIdExpression) { >- return getBinaryExpressionType(((CPPASTIdExpression) node.getOperand2()).getExpressionType()); >+ return getBinaryExpressionType((CPPASTIdExpression) node.getOperand2()); > } > } > return null; > } > >- private IASTDeclSpecifier getBinaryExpressionType(IType expressionType) { >+ private IASTDeclSpecifier getBinaryExpressionType(CPPASTIdExpression expression) { >+ IType expressionType = ((IVariable) expression.getName().resolveBinding()).getType(); >+ if (expressionType instanceof ITypedef) { >+ ITypedef typdef = (ITypedef) expressionType; >+ IType expandedType = expression.getExpressionType(); >+ if(typdef.getType().isSameType(expandedType)) { >+ return getDeclSpecifierForType(typdef); >+ }else{ >+ return getDeclSpecifierForType(expandedType); >+ } >+ >+ } >+ return getDeclSpecifierForType(expressionType); >+ >+ } >+ >+ private IASTDeclSpecifier getDeclSpecifierForType(IType expressionType) { >+ > if (expressionType instanceof CPPBasicType) { > > CPPBasicType basicType = (CPPBasicType) expressionType; > return createSimpleDeclSpecifier(basicType.getKind()); > > } else if (expressionType instanceof ITypedef) { >- >- return getDeclSpecForType(((ITypedef)expressionType)); >- >+ return getDeclSpecForType((ITypedef) expressionType); > } else if (expressionType instanceof ICPPClassType) { >- > return getDeclSpecForType((ICPPClassType)expressionType); > } > return null; >#P org.eclipse.cdt.ui.tests >Index: resources/refactoring/ExtractExpression.rts >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts,v >retrieving revision 1.6 >diff -u -r1.6 ExtractExpression.rts >--- resources/refactoring/ExtractExpression.rts 27 Oct 2008 10:01:41 -0000 1.6 >+++ resources/refactoring/ExtractExpression.rts 7 Dec 2010 13:22:51 -0000 >@@ -944,3 +944,31 @@ > bool b = invalid(); > } > >+//!Extract expresion with typdef Bug 331985 >+//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest >+ >+//@.config >+filename=test.cpp >+methodname=bar >+ >+//@test.cpp >+typedef int& foo; >+int test(foo s) { >+ int a= /*$*/s + 1/*$$*/; // type of id-expression 's' is int, not 'foo' or 'int&' >+ return a; >+} >+ >+ >+//= >+typedef int& foo; >+int bar(foo s) >+{ >+ return s + 1; >+} >+ >+int test(foo s) { >+ int a= bar(s); // type of id-expression 's' is int, not 'foo' or 'int&' >+ return a; >+} >+ >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
emanuel
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 331985
: 184715