Changeset cda7889


Ignore:
Timestamp:
Jul 12, 2017, 4:47:31 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
084fecc
Parents:
0698aa1
Message:

Parser no longer takes address of parameters to reference functions, implicit otype functions take references

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r0698aa1 rcda7889  
    296296Expression *build_unary_ptr( OperKinds op, ExpressionNode *expr_node ) {
    297297        std::list< Expression * > args;
    298         args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) );
     298        args.push_back(  maybeMoveBuild< Expression >(expr_node) ); // xxx
    299299        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    300300}
     
    307307Expression *build_binary_ptr( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
    308308        std::list< Expression * > args;
    309         args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1) ) );
     309        args.push_back( maybeMoveBuild< Expression >(expr_node1) );
    310310        args.push_back( maybeMoveBuild< Expression >(expr_node2) );
    311311        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
  • src/Parser/TypeData.cc

    r0698aa1 rcda7889  
    401401                        // add dtor:  void ^?{}(T *)
    402402                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    403                         dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     403                        dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    404404                        td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
    405405
    406406                        // add copy ctor:  void ?{}(T *, T)
    407407                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    408                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     408                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    409409                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    410410                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     
    412412                        // add default ctor:  void ?{}(T *)
    413413                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    414                         ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     414                        ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    415415                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
    416416
    417417                        // add assignment operator:  T * ?=?(T *, T)
    418418                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    419                         assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     419                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    420420                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    421421                        assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
  • src/Parser/parser.yy

    r0698aa1 rcda7889  
    665665        conditional_expression
    666666        | unary_expression assignment_operator assignment_expression
    667                 { $$ = new ExpressionNode( build_binary_ptr( $2, $1, $3 ) ); }
     667                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
    668668        ;
    669669
Note: See TracChangeset for help on using the changeset viewer.