mulang-ruby 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 534bc3c5a44381a2ba606c51162b1ccc664a20cdfe20470e3cd1c328fd43285b
4
- data.tar.gz: abddef43c33abb13f13ae185ba94e310d384e0257fb7a62a1192b18e8b0bd6b9
3
+ metadata.gz: 310222a26a40c26d470baccbff896da1b2f1ecf871391c2a5b1fb1dbebd4ff26
4
+ data.tar.gz: 26396d194ccc29a39bb2982dd83c4debb4dccc95a504fe6cac80c581d5dd433d
5
5
  SHA512:
6
- metadata.gz: 523da2d9961e079ddc1061988dfee999ae73f753ac386588066f8942676eb01e66725af10777da41a31f5ecc2037841e5574a7c11ceb2387bec245a99ee40973
7
- data.tar.gz: 6eba9d4083da3c9e63932c491c7b90d4b8b95ebe7e50fbb7c9bd99206e7ee56d41c938920ece70cdefc0baa72d6413f882991332e4efd0c5fe6485fa7e1331f8
6
+ metadata.gz: 67c0ecd31d721393beb7612cf56b8f31e1cfc5d51b0731ebd00b4f36026647992cb951afd3535707b9ed5ea7200bfb4cf0d632b5683f15f379d6116069d7d6dc
7
+ data.tar.gz: 9c4c5fea0ad0e708ca81fa8fc05b08bee69604865151458428e50fa09e99a17884d0f1366bffafeb3e2648d1202dfd7decf68a0595da9f19f03aaeaa9ad2da95
@@ -13,8 +13,8 @@ jobs:
13
13
  uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
14
14
  with:
15
15
  ruby-version: 2.6.3
16
- - name: Install dependencies
17
- run: bundle install
16
+ bundler: 2.1.4
17
+ bundler-cache: true
18
18
  - name: Run tests
19
19
  run: bundle exec rake
20
20
  - name: Deploy
@@ -3,25 +3,47 @@ module Mulang::Ruby
3
3
  include AST::Sexp
4
4
  include Mulang::Ruby::Sexp
5
5
 
6
+ def initialize
7
+ @contexts = []
8
+ end
9
+
6
10
  def process(node)
7
11
  node.nil? ? none : super
8
12
  end
9
13
 
10
14
  def on_class(node)
15
+ @contexts.push :class
16
+
11
17
  name, superclass, body = *node
12
18
 
13
19
  _, class_name = *name
14
20
  _, superclass_name = *superclass
15
21
 
16
22
  ms :Class, class_name, superclass_name, process(body)
23
+ ensure
24
+ @contexts.pop
25
+ end
26
+
27
+ def on_sclass(node)
28
+ @contexts.push :sclass
29
+
30
+ target, body = *node
31
+
32
+ ms :EigenClass, process(target), process(body)
33
+ ensure
34
+ @contexts.pop
17
35
  end
18
36
 
19
37
  def on_module(node)
38
+ @contexts.push :module
39
+
20
40
  name, body = *node
21
41
 
22
42
  _, module_name = *name
23
43
 
24
44
  ms :Object, module_name, process(body)
45
+ ensure
46
+ @contexts.pop
25
47
  end
26
48
 
27
49
  def on_begin(node)
@@ -114,9 +136,19 @@ module Mulang::Ruby
114
136
  end
115
137
 
116
138
  def on_defs(node)
117
- _target, id, args, body = *node
139
+ target, id, args, body = *node
140
+
141
+ result = simple_method id, process_all(args), process(body)
118
142
 
119
- simple_method id, process_all(args), process(body)
143
+ if target.type == :self
144
+ if @contexts.last == :module
145
+ result
146
+ else
147
+ ms(:Decorator, [ms(:Classy)], result)
148
+ end
149
+ else
150
+ ms(:EigenClass, process(target), result)
151
+ end
120
152
  end
121
153
 
122
154
  def on_def(node)
@@ -1,5 +1,5 @@
1
1
  module Mulang
2
2
  module Ruby
3
- VERSION = "6.1.0"
3
+ VERSION = '6.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mulang-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-10 00:00:00.000000000 Z
11
+ date: 2022-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler