@herb-tools/node 0.8.3 → 0.8.4

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.
@@ -6,7 +6,7 @@ import { createRequire } from 'module';
6
6
  import { fileURLToPath } from 'url';
7
7
 
8
8
  var name = "@herb-tools/node";
9
- var version = "0.8.3";
9
+ var version = "0.8.4";
10
10
  var packageJSON = {
11
11
  name: name,
12
12
  version: version};
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.3/templates/javascript/packages/node/extension/error_helpers.cpp.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.4/templates/javascript/packages/node/extension/error_helpers.cpp.erb
3
3
 
4
4
  #include <node_api.h>
5
5
  #include "error_helpers.h"
@@ -337,7 +337,7 @@ napi_value ErrorsArrayFromCArray(napi_env env, hb_array_T* array) {
337
337
  napi_create_array(env, &result);
338
338
 
339
339
  if (array) {
340
- for (size_t i = 0; i < hb_array_size(array); i++) {
340
+ for (size_t i = 0; i < array->size; i++) {
341
341
  ERROR_T* error = (ERROR_T*) hb_array_get(array, i);
342
342
  if (error) {
343
343
  napi_value js_error = ErrorFromCStruct(env, error);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.3/templates/javascript/packages/node/extension/error_helpers.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.4/templates/javascript/packages/node/extension/error_helpers.h.erb
3
3
 
4
4
  #ifndef HERB_EXTENSION_ERRORS_H
5
5
  #define HERB_EXTENSION_ERRORS_H
@@ -153,7 +153,7 @@ napi_value CreateLexResult(napi_env env, hb_array_T* tokens, napi_value source)
153
153
 
154
154
  // Add tokens to array
155
155
  if (tokens) {
156
- for (size_t i = 0; i < hb_array_size(tokens); i++) {
156
+ for (size_t i = 0; i < tokens->size; i++) {
157
157
  token_T* token = (token_T*)hb_array_get(tokens, i);
158
158
  if (token) {
159
159
  napi_value token_obj = CreateToken(env, token);
@@ -287,7 +287,7 @@ static AST_NODE_T* create_control_node(
287
287
 
288
288
  if (end_node) {
289
289
  end_position = end_node->base.location.end;
290
- } else if (children && hb_array_size(children) > 0) {
290
+ } else if (children && children->size > 0) {
291
291
  AST_NODE_T* last_child = hb_array_last(children);
292
292
  end_position = last_child->location.end;
293
293
  } else if (subsequent) {
@@ -329,7 +329,7 @@ static AST_NODE_T* create_control_node(
329
329
  hb_array_T* in_conditions = hb_array_init(8);
330
330
  hb_array_T* non_when_non_in_children = hb_array_init(8);
331
331
 
332
- for (size_t i = 0; i < hb_array_size(children); i++) {
332
+ for (size_t i = 0; i < children->size; i++) {
333
333
  AST_NODE_T* child = hb_array_get(children, i);
334
334
 
335
335
  if (child && child->type == AST_ERB_WHEN_NODE) {
@@ -343,7 +343,7 @@ static AST_NODE_T* create_control_node(
343
343
 
344
344
  hb_array_free(&children);
345
345
 
346
- if (hb_array_size(in_conditions) > 0) {
346
+ if (in_conditions->size > 0) {
347
347
  hb_array_free(&when_conditions);
348
348
 
349
349
  return (AST_NODE_T*) ast_erb_case_match_node_init(
@@ -539,7 +539,7 @@ static size_t process_control_structure(
539
539
  hb_array_T* in_conditions = hb_array_init(8);
540
540
  hb_array_T* non_when_non_in_children = hb_array_init(8);
541
541
 
542
- while (index < hb_array_size(array)) {
542
+ while (index < array->size) {
543
543
  AST_NODE_T* next_node = hb_array_get(array, index);
544
544
 
545
545
  if (!next_node) { break; }
@@ -555,7 +555,7 @@ static size_t process_control_structure(
555
555
  index++;
556
556
  }
557
557
 
558
- while (index < hb_array_size(array)) {
558
+ while (index < array->size) {
559
559
  AST_NODE_T* next_node = hb_array_get(array, index);
560
560
 
561
561
  if (!next_node) { break; }
@@ -627,7 +627,7 @@ static size_t process_control_structure(
627
627
 
628
628
  AST_ERB_ELSE_NODE_T* else_clause = NULL;
629
629
 
630
- if (index < hb_array_size(array)) {
630
+ if (index < array->size) {
631
631
  AST_NODE_T* next_node = hb_array_get(array, index);
632
632
 
633
633
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -661,7 +661,7 @@ static size_t process_control_structure(
661
661
 
662
662
  AST_ERB_END_NODE_T* end_node = NULL;
663
663
 
664
- if (index < hb_array_size(array)) {
664
+ if (index < array->size) {
665
665
  AST_NODE_T* potential_end = hb_array_get(array, index);
666
666
 
667
667
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -694,15 +694,15 @@ static size_t process_control_structure(
694
694
  end_position = end_node->base.location.end;
695
695
  } else if (else_clause) {
696
696
  end_position = else_clause->base.location.end;
697
- } else if (hb_array_size(when_conditions) > 0) {
697
+ } else if (when_conditions->size > 0) {
698
698
  AST_NODE_T* last_when = hb_array_last(when_conditions);
699
699
  end_position = last_when->location.end;
700
- } else if (hb_array_size(in_conditions) > 0) {
700
+ } else if (in_conditions->size > 0) {
701
701
  AST_NODE_T* last_in = hb_array_last(in_conditions);
702
702
  end_position = last_in->location.end;
703
703
  }
704
704
 
705
- if (hb_array_size(in_conditions) > 0) {
705
+ if (in_conditions->size > 0) {
706
706
  hb_array_T* case_match_errors = erb_node->base.errors;
707
707
  erb_node->base.errors = NULL;
708
708
 
@@ -760,7 +760,7 @@ static size_t process_control_structure(
760
760
  AST_ERB_ELSE_NODE_T* else_clause = NULL;
761
761
  AST_ERB_ENSURE_NODE_T* ensure_clause = NULL;
762
762
 
763
- if (index < hb_array_size(array)) {
763
+ if (index < array->size) {
764
764
  AST_NODE_T* next_node = hb_array_get(array, index);
765
765
 
766
766
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -775,7 +775,7 @@ static size_t process_control_structure(
775
775
  }
776
776
  }
777
777
 
778
- if (index < hb_array_size(array)) {
778
+ if (index < array->size) {
779
779
  AST_NODE_T* next_node = hb_array_get(array, index);
780
780
 
781
781
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -807,7 +807,7 @@ static size_t process_control_structure(
807
807
  }
808
808
  }
809
809
 
810
- if (index < hb_array_size(array)) {
810
+ if (index < array->size) {
811
811
  AST_NODE_T* next_node = hb_array_get(array, index);
812
812
 
813
813
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -819,7 +819,7 @@ static size_t process_control_structure(
819
819
 
820
820
  index++;
821
821
 
822
- while (index < hb_array_size(array)) {
822
+ while (index < array->size) {
823
823
  AST_NODE_T* child = hb_array_get(array, index);
824
824
 
825
825
  if (!child) { break; }
@@ -855,7 +855,7 @@ static size_t process_control_structure(
855
855
 
856
856
  AST_ERB_END_NODE_T* end_node = NULL;
857
857
 
858
- if (index < hb_array_size(array)) {
858
+ if (index < array->size) {
859
859
  AST_NODE_T* potential_end = hb_array_get(array, index);
860
860
 
861
861
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -922,7 +922,7 @@ static size_t process_control_structure(
922
922
 
923
923
  AST_ERB_END_NODE_T* end_node = NULL;
924
924
 
925
- if (index < hb_array_size(array)) {
925
+ if (index < array->size) {
926
926
  AST_NODE_T* potential_close = hb_array_get(array, index);
927
927
 
928
928
  if (potential_close && potential_close->type == AST_ERB_CONTENT_NODE) {
@@ -954,7 +954,7 @@ static size_t process_control_structure(
954
954
 
955
955
  if (end_node) {
956
956
  end_position = end_node->base.location.end;
957
- } else if (children && hb_array_size(children) > 0) {
957
+ } else if (children && children->size > 0) {
958
958
  AST_NODE_T* last_child = hb_array_last(children);
959
959
  end_position = last_child->location.end;
960
960
  }
@@ -984,7 +984,7 @@ static size_t process_control_structure(
984
984
  AST_NODE_T* subsequent = NULL;
985
985
  AST_ERB_END_NODE_T* end_node = NULL;
986
986
 
987
- if (index < hb_array_size(array)) {
987
+ if (index < array->size) {
988
988
  AST_NODE_T* next_node = hb_array_get(array, index);
989
989
 
990
990
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -997,7 +997,7 @@ static size_t process_control_structure(
997
997
  }
998
998
  }
999
999
 
1000
- if (index < hb_array_size(array)) {
1000
+ if (index < array->size) {
1001
1001
  AST_NODE_T* potential_end = hb_array_get(array, index);
1002
1002
 
1003
1003
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -1059,7 +1059,7 @@ static size_t process_subsequent_block(
1059
1059
  hb_array_free(&children);
1060
1060
  }
1061
1061
 
1062
- if (index < hb_array_size(array)) {
1062
+ if (index < array->size) {
1063
1063
  AST_NODE_T* next_node = hb_array_get(array, index);
1064
1064
 
1065
1065
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -1117,7 +1117,7 @@ static size_t process_block_children(
1117
1117
  analyze_ruby_context_T* context,
1118
1118
  control_type_t parent_type
1119
1119
  ) {
1120
- while (index < hb_array_size(array)) {
1120
+ while (index < array->size) {
1121
1121
  AST_NODE_T* child = hb_array_get(array, index);
1122
1122
 
1123
1123
  if (!child) { break; }
@@ -1139,7 +1139,7 @@ static size_t process_block_children(
1139
1139
  hb_array_T* temp_array = hb_array_init(1);
1140
1140
  size_t new_index = process_control_structure(node, array, index, temp_array, context, child_type);
1141
1141
 
1142
- if (hb_array_size(temp_array) > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }
1142
+ if (temp_array->size > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }
1143
1143
 
1144
1144
  hb_array_free(&temp_array);
1145
1145
 
@@ -1155,10 +1155,10 @@ static size_t process_block_children(
1155
1155
  }
1156
1156
 
1157
1157
  hb_array_T* rewrite_node_array(AST_NODE_T* node, hb_array_T* array, analyze_ruby_context_T* context) {
1158
- hb_array_T* new_array = hb_array_init(hb_array_size(array));
1158
+ hb_array_T* new_array = hb_array_init(array->size);
1159
1159
  size_t index = 0;
1160
1160
 
1161
- while (index < hb_array_size(array)) {
1161
+ while (index < array->size) {
1162
1162
  AST_NODE_T* item = hb_array_get(array, index);
1163
1163
 
1164
1164
  if (!item) { break; }
@@ -1293,7 +1293,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1293
1293
  if (if_node->end_node == NULL) { check_erb_node_for_missing_end(node); }
1294
1294
 
1295
1295
  if (if_node->statements != NULL) {
1296
- for (size_t i = 0; i < hb_array_size(if_node->statements); i++) {
1296
+ for (size_t i = 0; i < if_node->statements->size; i++) {
1297
1297
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(if_node->statements, i);
1298
1298
 
1299
1299
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
@@ -1325,7 +1325,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1325
1325
  const AST_ERB_IF_NODE_T* elsif_node = (const AST_ERB_IF_NODE_T*) subsequent;
1326
1326
 
1327
1327
  if (elsif_node->statements != NULL) {
1328
- for (size_t i = 0; i < hb_array_size(elsif_node->statements); i++) {
1328
+ for (size_t i = 0; i < elsif_node->statements->size; i++) {
1329
1329
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(elsif_node->statements, i);
1330
1330
 
1331
1331
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
@@ -1337,7 +1337,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1337
1337
  const AST_ERB_ELSE_NODE_T* else_node = (const AST_ERB_ELSE_NODE_T*) subsequent;
1338
1338
 
1339
1339
  if (else_node->statements != NULL) {
1340
- for (size_t i = 0; i < hb_array_size(else_node->statements); i++) {
1340
+ for (size_t i = 0; i < else_node->statements->size; i++) {
1341
1341
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(else_node->statements, i);
1342
1342
 
1343
1343
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.3/templates/src/analyze_missing_end.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.4/templates/src/analyze_missing_end.c.erb
3
3
 
4
4
  #include "include/analyze_helpers.h"
5
5
  #include "include/errors.h"
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.3/templates/src/analyze_transform.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.4/templates/src/analyze_transform.c.erb
3
3
 
4
4
  #include "include/analyze.h"
5
5
  #include "include/visitor.h"
@@ -43,7 +43,7 @@ ast_node_type_T ast_node_type(const AST_NODE_T* node) {
43
43
  }
44
44
 
45
45
  size_t ast_node_errors_count(const AST_NODE_T* node) {
46
- return hb_array_size(node->errors);
46
+ return node->errors->size;
47
47
  }
48
48
 
49
49
  hb_array_T* ast_node_errors(const AST_NODE_T* node) {