yarp 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/yarp/extension.c CHANGED
@@ -347,7 +347,7 @@ parse_input(yp_string_t *input, const char *filepath) {
347
347
  yp_node_t *node = yp_parse(&parser);
348
348
  rb_encoding *encoding = rb_enc_find(parser.encoding.name);
349
349
 
350
- VALUE source = yp_source_new(&parser);
350
+ VALUE source = yp_source_new(&parser, encoding);
351
351
  VALUE result_argv[] = {
352
352
  yp_ast_new(&parser, node, encoding),
353
353
  parser_comments(&parser, source),
@@ -413,7 +413,11 @@ parse_lex(int argc, VALUE *argv, VALUE self) {
413
413
 
414
414
  yp_string_t input;
415
415
  input_load_string(&input, string);
416
- return parse_lex_input(&input, check_string(filepath), true);
416
+
417
+ VALUE value = parse_lex_input(&input, check_string(filepath), true);
418
+ yp_string_free(&input);
419
+
420
+ return value;
417
421
  }
418
422
 
419
423
  // Parse and lex the given file and return a ParseResult instance.
@@ -530,6 +534,8 @@ profile_file(VALUE self, VALUE filepath) {
530
534
  yp_node_destroy(&parser, node);
531
535
  yp_parser_free(&parser);
532
536
 
537
+ yp_string_free(&input);
538
+
533
539
  return Qnil;
534
540
  }
535
541
 
@@ -547,6 +553,7 @@ parse_serialize_file_metadata(VALUE self, VALUE filepath, VALUE metadata) {
547
553
  yp_parse_serialize(yp_string_source(&input), yp_string_length(&input), &buffer, check_string(metadata));
548
554
  VALUE result = rb_str_new(yp_buffer_value(&buffer), yp_buffer_length(&buffer));
549
555
 
556
+ yp_string_free(&input);
550
557
  yp_buffer_free(&buffer);
551
558
  return result;
552
559
  }
data/ext/yarp/extension.h CHANGED
@@ -1,13 +1,13 @@
1
1
  #ifndef YARP_EXT_NODE_H
2
2
  #define YARP_EXT_NODE_H
3
3
 
4
- #define EXPECTED_YARP_VERSION "0.10.0"
4
+ #define EXPECTED_YARP_VERSION "0.12.0"
5
5
 
6
6
  #include <ruby.h>
7
7
  #include <ruby/encoding.h>
8
8
  #include "yarp.h"
9
9
 
10
- VALUE yp_source_new(yp_parser_t *parser);
10
+ VALUE yp_source_new(yp_parser_t *parser, rb_encoding *encoding);
11
11
  VALUE yp_token_new(yp_parser_t *parser, yp_token_t *token, rb_encoding *encoding, VALUE source);
12
12
  VALUE yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding);
13
13