From f661185d6fe3197ee434007db4f3af854e85c7e5 Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 3 Jun 2016 03:14:54 +0900 Subject: [PATCH] update for Crystal 0.17.4 --- README.md | 2 +- src/crisp/core.cr | 4 ++-- src/crisp/env.cr | 2 +- src/crisp/error.cr | 2 +- src/crisp/expr.cr | 11 ++++------- src/crisp/reader.cr | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index dbd01a4..081f740 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Please see [mal test cases](https://github.com/rhysd/Crisp/tree/master/spec/cris ## Development Environment - OS X -- Crystal 0.7.1 ~ 0.7.3 or 0.7.7 ~ 0.11.0 +- Crystal 0.7.1 ~ 0.7.3 or 0.7.7 ~ 0.11.0 or 0.17.4 ## License diff --git a/src/crisp/core.cr b/src/crisp/core.cr index fe2b148..e21b626 100644 --- a/src/crisp/core.cr +++ b/src/crisp/core.cr @@ -149,7 +149,7 @@ module Crisp end end - def nil?(args) + def nil_value?(args) args.first.unwrap.nil? end @@ -380,7 +380,7 @@ module Crisp "throw" => -> (args : Array(Crisp::Expr)) { raise Crisp::RuntimeException.new args[0] }, "apply" => func(:apply), "map" => func(:map), - "nil?" => func(:nil?), + "nil?" => func(:nil_value?), "true?" => func(:true?), "false?" => func(:false?), "symbol?" => func(:symbol?), diff --git a/src/crisp/env.cr b/src/crisp/env.cr index 1dea91c..3cc6306 100644 --- a/src/crisp/env.cr +++ b/src/crisp/env.cr @@ -6,7 +6,7 @@ module Crisp class Env property data - def initialize(@outer = nil) + def initialize(@outer : Env? = nil) @data = {} of String => Crisp::Expr end diff --git a/src/crisp/error.cr b/src/crisp/error.cr index c715676..d24bda1 100644 --- a/src/crisp/error.cr +++ b/src/crisp/error.cr @@ -9,7 +9,7 @@ module Crisp class RuntimeException < Exception getter :thrown - def initialize(@thrown) + def initialize(@thrown : Crisp::Expr) super() end end diff --git a/src/crisp/expr.cr b/src/crisp/expr.cr index 0b6ab54..eccf59b 100644 --- a/src/crisp/expr.cr +++ b/src/crisp/expr.cr @@ -5,7 +5,7 @@ module Crisp class Symbol property :str - def initialize(@str) + def initialize(@str : String) end def ==(other : Symbol) @@ -24,7 +24,7 @@ module Crisp class Atom property :val - def initialize(@val) + def initialize(@val : Expr) end def ==(rhs : Atom) @@ -34,7 +34,7 @@ module Crisp class Closure property :ast, :params, :env, :fn - def initialize(@ast, @params, @env, @fn) + def initialize(@ast : Expr, @params : List | Vector, @env : Env, @fn : Func) end end @@ -42,14 +42,11 @@ module Crisp alias Func = (Array(Expr) -> Expr) alias Type = Nil | Bool | Int32 | String | Symbol | List | Vector | HashMap | Func | Closure | Atom - is_macro :: Bool - meta :: Expr - property :is_macro, :meta def initialize(@val : Type) @is_macro = false - @meta = nil + @meta = nil as Expr? end def initialize(other : Expr) diff --git a/src/crisp/reader.cr b/src/crisp/reader.cr index 7efc5c5..224647e 100644 --- a/src/crisp/reader.cr +++ b/src/crisp/reader.cr @@ -5,7 +5,7 @@ module Crisp extend self class Reader - def initialize(@tokens) + def initialize(@tokens : Array(String)) @pos = 0 end