Skip to content

Commit

Permalink
Merge pull request #36 from mint-lang/crystal-next
Browse files Browse the repository at this point in the history
Support for Crystal 0.25
  • Loading branch information
gdotdesign authored Jun 17, 2018
2 parents 998fd7a + 203339e commit d25fc9d
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
crystal build src/mint.cr -o mint -p -d && mv mint ~/.bin/mint && mint
crystal build src/mint.cr -o mint -p && mv mint ~/.bin/mint && mint

test:
crystal spec -p && bin/ameba
Expand Down
10 changes: 5 additions & 5 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ shards:

ameba:
github: veelenga/ameba
version: 0.6.0
version: 0.7.0

baked_file_system:
github: schovi/baked_file_system
version: 0.9.6
commit: e1447549d5ac0560720fae62179b2f2c62c9bfd1

duktape:
github: jessedoyle/duktape.cr
version: 0.13.0
version: 0.14.1

kemal:
github: kemalcr/kemal
version: 0.22.0
commit: a5870e7d24e5ec75c956bcf3e4423f55a2c4ff78

kilt:
github: jeromegn/kilt
Expand All @@ -34,7 +34,7 @@ shards:

time_format:
github: vladfaust/time_format.cr
version: 0.1.0
version: 0.1.1

tree_template:
github: anykeyh/tree_template
Expand Down
6 changes: 3 additions & 3 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mint
version: 1.0.0
version: 0.0.5

targets:
mint:
Expand All @@ -8,20 +8,20 @@ targets:
dependencies:
duktape:
github: jessedoyle/duktape.cr
version: ~> 0.13.0
string_inflection:
github: mosop/string_inflection
baked_file_system:
github: schovi/baked_file_system
branch: master
kemal:
github: kemalcr/kemal
branch: master
admiral:
github: jwaldrip/admiral.cr
tree_template:
github: anykeyh/tree_template
time_format:
github: vladfaust/time_format.cr
version: ~> 0.1.0

development_dependencies:
ameba:
Expand Down
9 changes: 9 additions & 0 deletions src/ast.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ module Mint
StringLiteral |
NumberLiteral |
HtmlComponent |
ArrayLiteral |
RecordUpdate |
ModuleAccess |
FunctionCall |
BoolLiteral |
HtmlElement |
ModuleCall |
Operation |
NextCall |
Variable |
Record |
EnumId |
Access |
Decode |
Routes |
Route |
With |
Case |
Void |
Try |
Do |
If |
Js

Expand Down
2 changes: 1 addition & 1 deletion src/compilers/component.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module Mint

def compile_component_store_data(node : Ast::Component) : Array(String)
node.connects.reduce([] of String) do |memo, item|
store = ast.stores.find { |store| store.name == item.store }
store = ast.stores.find { |entity| entity.name == item.store }

if store
item.keys.map do |key|
Expand Down
4 changes: 2 additions & 2 deletions src/mint_json.cr
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ module Mint
repository = nil
constraint = nil

@parser.read_object_or_null do |key|
case key
@parser.read_object_or_null do |dependency_key|
case dependency_key
when "repository"
repository = @parser.read_string
when "constraint"
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/case.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Mint
end

Ast::Case.new(
condition: condition,
condition: condition.as(Ast::Expression),
from: start_position,
branches: branches,
to: position,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/case_branch.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Mint
expression = expression! CaseBranchExpectedExpression

Ast::CaseBranch.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
to: position,
match: match,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/catch.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Mint
end

Ast::Catch.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
variable: variable,
to: position,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/decode.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Mint
type = type! DecodeExpectedType

Ast::Decode.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
type: type,
to: position,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/finally.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Mint
end

Ast::Finally.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
to: position,
input: data)
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/function.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ module Mint
whitespace

Ast::Function.new(
body: body.as(Ast::Expression),
arguments: arguments,
from: start_position,
to: end_position,
wheres: where,
input: data,
name: name,
type: type,
body: body)
type: type)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/html_attribute.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Mint
end

Ast::HtmlAttribute.new(
value: value.as(Ast::Expression),
from: start_position,
value: value,
to: position,
input: data,
name: name)
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/html_expression.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Mint
keyword! "}>", HtmlExpressionExpectedClosingTag

Ast::HtmlExpression.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
to: position,
input: data)
Expand Down
6 changes: 3 additions & 3 deletions src/parsers/if.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ module Mint
end

Ast::If.new(
condition: condition,
condition: condition.as(Ast::Expression),
truthy: truthy.as(Ast::Expression),
falsy: falsy.as(Ast::Expression),
from: start_position,
truthy: truthy,
falsy: falsy,
to: position,
input: data)
end
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/inline_function.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ module Mint
body = expression! InlineFunctionExpectedExpression

Ast::InlineFunction.new(
body: body.as(Ast::Expression),
arguments: arguments,
from: start_position,
to: position,
input: data,
body: body)
input: data)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/negated_expression.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module Mint
expression = expression! NegatedExpressionExpectedExpression

Ast::NegatedExpression.new(
expression: expression.as(Ast::Expression),
negations: negations,
expression: expression,
from: start_position,
to: position,
input: data)
Expand Down
6 changes: 3 additions & 3 deletions src/parsers/operation.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ module Mint
else
return operation(
Ast::Operation.new(
right: right.as(Ast::Expression),
left: left.as(Ast::Expression),
operator: operator,
from: left.from,
to: right.to,
right: right,
input: data,
left: left),
input: data),
next_operator)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/parenthesized_expression.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Mint
char ')', ParenthesizedExpressionExpectedClosingParentheses

Ast::ParenthesizedExpression.new(
expression: expression,
expression: expression.as(Ast::Expression),
from: start_position,
to: position,
input: data)
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/property.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Mint
default = expression! PropertyExpectedDefaultValue

Ast::Property.new(
default: default.as(Ast::Expression),
from: start_position,
default: default,
to: position,
input: data,
type: type,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/record_field.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module Mint
value = expression! RecordFieldExpectedExpression

Ast::RecordField.new(
value: value.as(Ast::Expression),
from: start_position,
value: value,
to: position,
input: data,
key: key)
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module Mint
skip unless body

Ast::Statement.new(
expression: body.as(Ast::Expression),
from: start_position,
expression: body,
to: position,
input: data,
name: name)
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Mint
end

Ast::Type.new(
parameters: parameters || [] of Ast::Type | Ast::Variable,
parameters: parameters || [] of Ast::Type | Ast::TypeVariable,
from: start_position,
to: position,
input: data,
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/with.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ module Mint
end

Ast::With.new(
body: body.as(Ast::Expression),
from: start_position,
to: position,
input: data,
name: name,
body: body)
name: name)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions src/test_runner.cr
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ module Mint
end

def compile_ast
file =
file_argument =
@arguments.test

ast =
Ast.new

sources =
if file
Dir.glob([file] + SourceFiles.all)
if file_argument
Dir.glob([file_argument] + SourceFiles.all)
else
Dir.glob(SourceFiles.tests + SourceFiles.all)
end
Expand Down Expand Up @@ -245,9 +245,9 @@ module Mint
puts " #{ARROW} #{@succeeded} passed"
puts " #{ARROW} #{@failed.size} failed"

@failed.each do |message|
puts " #{message.name}".colorize(:red).to_s
puts " |> #{message.result}".colorize(:red).to_s
@failed.each do |faliure|
puts " #{faliure.name}".colorize(:red).to_s
puts " |> #{faliure.result}".colorize(:red).to_s
end

Kemal.config.server.try(&.close) unless @flags.manual
Expand Down
9 changes: 5 additions & 4 deletions src/type_checkers/scope.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module Mint
Ast::Function |
Ast::Provider |
Ast::Module |
Ast::Store
Ast::Store |
Ast::Get

alias Level = Tuple(Ast::Node | Type, Node)
alias Lookup = Tuple(Ast::Node | Type, Node, Array(Node))
Expand Down Expand Up @@ -185,7 +186,7 @@ module Mint
end
end
end.compact
.reduce([] of Ast::Property) { |memo, item| memo.concat(item) }
.reduce([] of Ast::Property) { |memo, item| memo.concat(item) }
end

private def store_gets(component)
Expand All @@ -199,7 +200,7 @@ module Mint
end
end
end.compact
.reduce([] of Ast::Get) { |memo, item| memo.concat(item) }
.reduce([] of Ast::Get) { |memo, item| memo.concat(item) }
end

private def store_functions(component)
Expand All @@ -212,7 +213,7 @@ module Mint
end
end
end.compact
.reduce([] of Ast::Function) { |memo, item| memo.concat(item) }
.reduce([] of Ast::Function) { |memo, item| memo.concat(item) }
end
end
end
Expand Down
Loading

0 comments on commit d25fc9d

Please sign in to comment.