From d1b10e2960021b07651874775ef0fb31696fe7ea Mon Sep 17 00:00:00 2001 From: RX14 Date: Thu, 13 Jul 2017 11:00:36 +0100 Subject: [PATCH] Rename skip() macro method to skip_file() There was a miscommunication in the macro's name when implementing Crystal::System, meaning that skip_file was used but the method was implemented as skip. In addition, add parens to skip_file to make it parse as a function call. --- spec/compiler/semantic/macro_spec.cr | 6 +++--- src/compiler/crystal/macros/methods.cr | 6 +++--- src/crystal/system/unix/arc4random.cr | 2 +- src/crystal/system/unix/getrandom.cr | 2 +- src/crystal/system/unix/sysconf_cpucount.cr | 2 +- src/crystal/system/unix/sysctl_cpucount.cr | 2 +- src/crystal/system/unix/urandom.cr | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/compiler/semantic/macro_spec.cr b/spec/compiler/semantic/macro_spec.cr index cc40def9203b..1cd11cf6dc2e 100644 --- a/spec/compiler/semantic/macro_spec.cr +++ b/spec/compiler/semantic/macro_spec.cr @@ -989,13 +989,13 @@ describe "Semantic: macro" do )) { int32 } end - describe "skip macro directive" do + describe "skip_file macro directive" do it "skips expanding the rest of the current file" do res = semantic(%( class A end - {% skip() %} + {% skip_file() %} class B end @@ -1012,7 +1012,7 @@ describe "Semantic: macro" do {% if true %} class C; end - {% skip() %} + {% skip_file() %} class D; end {% end %} diff --git a/src/compiler/crystal/macros/methods.cr b/src/compiler/crystal/macros/methods.cr index 020203ad6c25..53b26a79a3e0 100644 --- a/src/compiler/crystal/macros/methods.cr +++ b/src/compiler/crystal/macros/methods.cr @@ -19,8 +19,8 @@ module Crystal interpret_puts(node) when "pp" interpret_pp(node) - when "skip" - interpret_skip(node) + when "skip_file" + interpret_skip_file(node) when "system", "`" interpret_system(node) when "raise" @@ -133,7 +133,7 @@ module Crystal @last = Nop.new end - def interpret_skip(node) + def interpret_skip_file(node) raise SkipMacroException.new(@str.to_s) end diff --git a/src/crystal/system/unix/arc4random.cr b/src/crystal/system/unix/arc4random.cr index 67aa0867560a..863c0978eb3f 100644 --- a/src/crystal/system/unix/arc4random.cr +++ b/src/crystal/system/unix/arc4random.cr @@ -1,4 +1,4 @@ -{% skip_file unless flag?(:openbsd) %} +{% skip_file() unless flag?(:openbsd) %} require "c/stdlib" diff --git a/src/crystal/system/unix/getrandom.cr b/src/crystal/system/unix/getrandom.cr index 68ae5035a0e9..b1cd2f3c7523 100644 --- a/src/crystal/system/unix/getrandom.cr +++ b/src/crystal/system/unix/getrandom.cr @@ -1,4 +1,4 @@ -{% skip_file unless flag?(:linux) %} +{% skip_file() unless flag?(:linux) %} require "c/unistd" require "c/sys/syscall" diff --git a/src/crystal/system/unix/sysconf_cpucount.cr b/src/crystal/system/unix/sysconf_cpucount.cr index 9c0550928092..58eed376da5c 100644 --- a/src/crystal/system/unix/sysconf_cpucount.cr +++ b/src/crystal/system/unix/sysconf_cpucount.cr @@ -1,4 +1,4 @@ -{% skip_file if flag?(:openbsd) || flag?(:freebsd) %} +{% skip_file() if flag?(:openbsd) || flag?(:freebsd) %} require "c/unistd" diff --git a/src/crystal/system/unix/sysctl_cpucount.cr b/src/crystal/system/unix/sysctl_cpucount.cr index ec3a55852fe8..f5646b1b0377 100644 --- a/src/crystal/system/unix/sysctl_cpucount.cr +++ b/src/crystal/system/unix/sysctl_cpucount.cr @@ -1,4 +1,4 @@ -{% skip_file unless flag?(:openbsd) || flag?(:freebsd) %} +{% skip_file() unless flag?(:openbsd) || flag?(:freebsd) %} require "c/sysctl" diff --git a/src/crystal/system/unix/urandom.cr b/src/crystal/system/unix/urandom.cr index d42612dfa0b6..f44f12b1c9c6 100644 --- a/src/crystal/system/unix/urandom.cr +++ b/src/crystal/system/unix/urandom.cr @@ -1,5 +1,5 @@ # TODO: replace with `flag?(:unix) && !flag?(:openbsd) && !flag?(:linux)` after crystal > 0.22.0 is released -{% skip_file if flag?(:openbsd) && flag?(:linux) %} +{% skip_file() if flag?(:openbsd) && flag?(:linux) %} module Crystal::System::Random @@initialized = false