| Summary: | IntegerLiteral.getType() and DecimalLiteral.getType() may be incorrect | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Matt Heitz <mheitz> |
| Component: | EDT | Assignee: | Matt Heitz <mheitz> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | pharmon |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Matt Heitz
If we use my suggestion from BugĀ 348642 , IntegerLiteral could be fixed this way: public Type getType() { if ( fitsInSmallint() ) return IRUtils.getEGLPrimitiveType(Type_Smallint); else if ( fitsInInt() ) return IRUtils.getEGLPrimitiveType(Type_Int); else if ( fitsInBigint() ) return IRUtils.getEGLPrimitiveType(Type_Bigint); int length = getValue().length(); if ( isNegated() ) { length--; } return IRUtils.getEGLPrimitiveType(Type_Decimal, length, 0); } DecimalLiteral's fix is: public Type getType() { String value = getValue(); int length = value.length() - 1; if ( isNegated() ) { length--; } int decimals = value.substring( value.indexOf( '.' ) + 1 ).length(); return IRUtils.getEGLPrimitiveType( Type_Decimal, length, decimals ); } i have put in fixes for IntgerLiteralImpl and DecimalLiteralImpl Looks good. And just for the historical record, integers that are too big to be a bigint have type num, not decimal as I put in the description. |