Skip to content

Commit 6c77c6b

Browse files
authored
Merge pull request #2102 from Shopify/templated-code-gen2
Clean up temporary workarounds from templated code
2 parents 7c561d0 + d56b699 commit 6c77c6b

File tree

19 files changed

+121
-1571
lines changed

19 files changed

+121
-1571
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ lib/**/*.bundle
1919
lib/**/*.so
2020
lib/**/*.dll
2121
doc/
22+
23+
include/rbs/constants.h
24+
include/rbs/ruby_objs.h
25+
src/constants.c
26+
src/ruby_objs.c
27+
2228
**/*.gem

Rakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ task :confirm_annotation do
4444
end
4545

4646
task :templates do
47-
sh "bundle exec ruby templates/template.rb ext/rbs_extension/constants.h"
48-
sh "bundle exec ruby templates/template.rb ext/rbs_extension/ruby_objs.h"
49-
sh "bundle exec ruby templates/template.rb ext/rbs_extension/constants.c"
50-
sh "bundle exec ruby templates/template.rb ext/rbs_extension/ruby_objs.c"
47+
sh "bundle exec ruby templates/template.rb include/rbs/constants.h"
48+
sh "bundle exec ruby templates/template.rb include/rbs/ruby_objs.h"
49+
sh "bundle exec ruby templates/template.rb src/constants.c"
50+
sh "bundle exec ruby templates/template.rb src/ruby_objs.c"
5151
end
5252

5353
task :compile => "ext/rbs_extension/lexer.c"

config.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ nodes:
209209
- name: RBS::Types::Alias
210210
fields:
211211
- name: name
212-
c_name: typename # Temporary name to match existing C code. Will be removed in next PR.
213212
- name: args
214213
- name: location
215214
- name: RBS::Types::Bases::Any
@@ -247,25 +246,18 @@ nodes:
247246
- name: RBS::Types::ClassInstance
248247
fields:
249248
- name: name
250-
c_name: typename # Temporary name to match existing C code. Will be removed in next PR.
251249
- name: args
252-
c_name: type_args # Temporary name to match existing C code. Will be removed in next PR.
253250
- name: location
254251
- name: RBS::Types::ClassSingleton
255252
fields:
256253
- name: name
257-
c_name: typename # Temporary name to match existing C code. Will be removed in next PR.
258254
- name: location
259255
- name: RBS::Types::Function
260256
fields:
261257
- name: required_positionals
262-
c_name: required_positional_params # Temporary name to match existing C code. Will be removed in next PR.
263258
- name: optional_positionals
264-
c_name: optional_positional_params # Temporary name to match existing C code. Will be removed in next PR.
265259
- name: rest_positionals
266-
c_name: rest_positional_params # Temporary name to match existing C code. Will be removed in next PR.
267260
- name: trailing_positionals
268-
c_name: trailing_positional_params # Temporary name to match existing C code. Will be removed in next PR.
269261
- name: required_keywords
270262
- name: optional_keywords
271263
- name: rest_keywords
@@ -278,9 +270,7 @@ nodes:
278270
- name: RBS::Types::Interface
279271
fields:
280272
- name: name
281-
c_name: typename # Temporary name to match existing C code. Will be removed in next PR.
282273
- name: args
283-
c_name: type_args # Temporary name to match existing C code. Will be removed in next PR.
284274
- name: location
285275
- name: RBS::Types::Intersection
286276
fields:
@@ -297,14 +287,12 @@ nodes:
297287
- name: RBS::Types::Proc
298288
fields:
299289
- name: type
300-
c_name: function # Temporary name to match existing C code. Will be removed in next PR.
301290
- name: block
302291
- name: location
303292
- name: self_type
304293
- name: RBS::Types::Record
305294
fields:
306295
- name: all_fields
307-
c_name: fields # Temporary name to match existing C code. Will be removed in next PR.
308296
- name: location
309297
- name: RBS::Types::Tuple
310298
fields:

ext/rbs_extension/constants.c

Lines changed: 0 additions & 155 deletions
This file was deleted.

ext/rbs_extension/constants.h

Lines changed: 0 additions & 82 deletions
This file was deleted.

ext/rbs_extension/extconf.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
require 'mkmf'
2+
23
$INCFLAGS << " -I$(top_srcdir)" if $extmk
4+
$INCFLAGS << " -I$(srcdir)/../../include"
5+
6+
$VPATH << "$(srcdir)/../../src"
7+
$VPATH << "$(srcdir)/ext/rbs_extension"
8+
9+
root_dir = File.expand_path('../../../', __FILE__)
10+
$srcs = Dir.glob("#{root_dir}/src/*.c") +
11+
Dir.glob("#{root_dir}/ext/rbs_extension/*.c")
12+
313
append_cflags ['-std=gnu99']
414
create_makefile 'rbs_extension'

ext/rbs_extension/rbs_extension.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
#include "ruby/re.h"
55
#include "ruby/encoding.h"
66

7+
#include "rbs.h"
78
#include "lexer.h"
89
#include "parser.h"
9-
#include "constants.h"
10-
#include "ruby_objs.h"
1110

1211
/**
1312
* Receives `parserstate` and `range`, which represents a string token or symbol token, and returns a string VALUE.

0 commit comments

Comments
 (0)