Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5362e25d22f8
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 34cf351af8e4
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 19, 2017

  1. Document flag? macro method

    asterite committed Aug 19, 2017
    Copy the full SHA
    444e80c View commit details
  2. Copy the full SHA
    34cf351 View commit details
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/compiler/crystal/macros.cr
8 changes: 8 additions & 0 deletions src/compiler/crystal/macros.cr
Original file line number Diff line number Diff line change
@@ -27,6 +27,14 @@ module Crystal::Macros
def env(name) : StringLiteral | NilLiteral
end

# Returns whether a [compile-time flag](https://crystal-lang.org/docs/syntax_and_semantics/compile_time_flags.html) is set.
#
# ```
# {{ flag?(:x86_64) }} # true or false
# ```
def flag?(name) : BoolLiteral
end

# Prints an AST node at compile-time. Useful for debugging macros.
def puts(expression) : Nop
end