Changeset 46da46b for src/Parser
- Timestamp:
- May 2, 2023, 3:44:31 AM (17 months ago)
- Branches:
- ast-experimental, master
- Children:
- 0c840fc
- Parents:
- 1ab773e0
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r1ab773e0 r46da46b 544 544 }; // OperName 545 545 546 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {546 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node, CastExpr::CastKind kind ) { 547 547 Type * targetType = maybeMoveBuildType( decl_node ); 548 548 if ( dynamic_cast< VoidType * >( targetType ) ) { 549 549 delete targetType; 550 return new CastExpr( maybeMoveBuild< Expression >(expr_node), false );550 return new CastExpr( maybeMoveBuild< Expression >(expr_node), false, kind ); 551 551 } else { 552 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType, false );552 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType, false, kind ); 553 553 } // if 554 554 } // build_cast -
src/Parser/ParseNode.h
r1ab773e0 r46da46b 189 189 DimensionExpr * build_dimensionref( const std::string * name ); 190 190 191 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );191 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node, CastExpr::CastKind kind = CastExpr::Default ); 192 192 Expression * build_keyword_cast( AggregateDecl::Aggregate target, ExpressionNode * expr_node ); 193 193 Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ); -
src/Parser/parser.yy
r1ab773e0 r46da46b 905 905 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild<Expression>( $5 ), maybeMoveBuildType( $3 ) ) ); } 906 906 | '(' RETURN type_no_function ')' cast_expression // CFA 907 { SemanticError( yylloc, "Return cast is currently unimplemented." ); $$ = nullptr; }907 { $$ = new ExpressionNode( build_cast( $3, $5, CastExpr::Return ) ); } 908 908 | '(' COERCE type_no_function ')' cast_expression // CFA 909 909 { SemanticError( yylloc, "Coerce cast is currently unimplemented." ); $$ = nullptr; }
Note: See TracChangeset
for help on using the changeset viewer.