Changeset 1cdfa82 for src/Parser/ExpressionNode.cc
- Timestamp:
- Apr 25, 2018, 4:55:53 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- 42107b4
- Parents:
- 2efe4b8 (diff), 9d5fb67 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r2efe4b8 r1cdfa82 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Mar 3 18:22:33201813 // Update Count : 79612 // Last Modified On : Thu Mar 22 11:57:39 2018 13 // Update Count : 801 14 14 // 15 15 … … 94 94 } // checkLNInt 95 95 96 static void sepNumeric( string & str, string & units ) {97 string::size_type posn = str.find_first_of( "`" );98 if ( posn != string::npos ) {99 units = "?" + str.substr( posn ); // extract units100 str.erase( posn ); // remove units101 } // if102 } // sepNumeric103 104 96 Expression * build_constantInteger( string & str ) { 105 97 static const BasicType::Kind kind[2][6] = { … … 108 100 { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, }, 109 101 }; 110 111 string units;112 sepNumeric( str, units ); // separate constant from units113 102 114 103 bool dec = true, Unsigned = false; // decimal, unsigned constant … … 222 211 if ( Unsigned && size < 2 ) { // hh or h, less than int ? 223 212 // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values. 224 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );213 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false ); 225 214 } else if ( lnth != -1 ) { // explicit length ? 226 215 if ( lnth == 5 ) { // int128 ? 227 216 size = 5; 228 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );217 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false ); 229 218 } else { 230 ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ) );219 ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ), false ); 231 220 } // if 232 221 } // if 233 222 CLEANUP: 234 if ( units.length() != 0 ) {235 ret = new UntypedExpr( new NameExpr( units ), { ret } );236 } // if237 223 238 224 delete &str; // created by lex … … 268 254 }; 269 255 270 string units;271 sepNumeric( str, units ); // separate constant from units272 273 256 bool complx = false; // real, complex 274 257 int size = 1; // 0 => float, 1 => double, 2 => long double … … 302 285 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) ); 303 286 if ( lnth != -1 ) { // explicit length ? 304 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) ); 305 } // if 306 if ( units.length() != 0 ) { 307 ret = new UntypedExpr( new NameExpr( units ), { ret } ); 287 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ), false ); 308 288 } // if 309 289 … … 427 407 Type * targetType = maybeMoveBuildType( decl_node ); 428 408 if ( dynamic_cast< VoidType * >( targetType ) ) { 429 return new CastExpr( maybeMoveBuild< Expression >(expr_node) );409 return new CastExpr( maybeMoveBuild< Expression >(expr_node), false ); 430 410 } else { 431 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType );411 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType, false ); 432 412 } // if 433 413 } // build_cast 414 415 Expression * build_keyword_cast( KeywordCastExpr::Target target, ExpressionNode * expr_node ) { 416 return new KeywordCastExpr( maybeMoveBuild< Expression >(expr_node), target ); 417 } 434 418 435 419 Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
Note: See TracChangeset
for help on using the changeset viewer.