Home | History | Annotate | Line # | Download | only in dmd
      1 /**
      2  * Performs inlining, which is an optimization pass enabled with the `-inline` flag.
      3  *
      4  * The AST is traversed, and every function call is considered for inlining using `inlinecost.d`.
      5  * The function call is then inlined if this cost is below a threshold.
      6  *
      7  * Copyright:   Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
      8  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
      9  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
     10  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/inline.d, _inline.d)
     11  * Documentation:  https://dlang.org/phobos/dmd_inline.html
     12  * Coverage:    https://codecov.io/gh/dlang/dmd/src/master/src/dmd/inline.d
     13  */
     14 
     15 module dmd.inline;
     16 
     17 import dmd.dscope;
     18 import dmd.expression;
     19 
     20 /***********************************************************
     21  * Perform the "inline copying" of a default argument for a function parameter.
     22  *
     23  * Todo:
     24  *  The hack for bugzilla 4820 case is still questionable. Perhaps would have to
     25  *  handle a delegate expression with 'null' context properly in front-end.
     26  */
     27 public Expression inlineCopy(Expression e, Scope* sc)
     28 {
     29     return e.copy();
     30 }
     31