Skip to content

Commit ad4b814

Browse files
committed
Make native types declared in the setting be lexically scoped.
1 parent 3befd15 commit ad4b814

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/Regex.pir

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@ This file brings together the various Regex modules needed for Regex.pbc .
1111
=cut
1212

1313
.HLL 'nqp'
14+
.loadlib "nqp_group"
15+
.loadlib "nqp_ops"
1416

1517
.sub '' :load :init
18+
# Create a serialization context for this compilation unit.
19+
.local pmc sc
20+
sc = nqp_create_sc "__REGEX_CORE_SC__"
21+
22+
# Load setting.
1623
load_bytecode 'SettingManager.pbc'
1724
$P0 = get_hll_global ['HLL'], 'SettingManager'
18-
$P0.'load_setting'('NQPCORE')
25+
say "# loading setting"
26+
$P1 = $P0.'load_setting'('NQPCORE')
27+
$P1 = getattribute $P1, 'lex_pad'
28+
set_hll_global 'SETTING', $P1
1929
.end
2030

2131
.include 'src/Regex/Cursor.pir'

src/Regex/Cursor.pir

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ grammars.
1313

1414
=cut
1515

16-
.loadlib "nqp_group"
17-
.loadlib "nqp_ops"
18-
1916
.include 'cclass.pasm'
2017
.include 'src/Regex/constants.pir'
2118

@@ -150,9 +147,10 @@ grammars.
150147
how.'add_parrot_vtable_mapping'(type_obj, 'get_bool', $P17)
151148

152149
# Add attributes.
153-
.local pmc NQPAttribute, int_type, attr
150+
.local pmc NQPAttribute, SETTING, int_type, attr
154151
NQPAttribute = get_hll_global "NQPAttribute"
155-
int_type = get_hll_global "int"
152+
SETTING = get_hll_global "SETTING"
153+
int_type = SETTING["int"]
156154
attr = NQPAttribute."new"("$!target" :named("name"))
157155
how."add_attribute"(type_obj, attr)
158156
attr = NQPAttribute."new"("$!from" :named("name"), int_type :named('type'))

src/core/NativeTypes.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
native int is repr('P6int') { }
1+
my native int is repr('P6int') { }
22

3-
native num is repr('P6num') { }
3+
my native num is repr('P6num') { }
44

5-
native str is repr('P6str') { }
5+
my native str is repr('P6str') { }

0 commit comments

Comments
 (0)