@@ -103,10 +103,7 @@ class BackendRM86 : CompilerBackend {
103103 // what?
104104 foreach (global ; globals) {
105105 if (global.type.hasInit && ! global.type.ptr) {
106- if (
107- (output.mode == OutputMode.Module) &&
108- (global.mod != output.GetModName())
109- ) {
106+ if (output.mode == OutputMode.Module) {
110107 continue ;
111108 }
112109
@@ -116,8 +113,10 @@ class BackendRM86 : CompilerBackend {
116113 );
117114 output ~= " add si, 2\n " ;
118115 output ~= format(
119- " call %s\n " ,
120- Label(" __type_init_" , " %s" , global.type.name.Sanitise())
116+ " call %s\n " , ExtLabel(
117+ global.type.mod, " __type_init_" , " %s" ,
118+ global.type.name.Sanitise()
119+ )
121120 );
122121 }
123122 }
@@ -171,9 +170,17 @@ class BackendRM86 : CompilerBackend {
171170 override void End () {
172171 foreach (global ; globals) {
173172 if (global.type.hasDeinit && ! global.type.ptr) {
174- output ~= format(" mov word [si], word __global_%s\n " , Sanitise(global.name));
173+ output ~= format(
174+ " mov word [si], word %s\n " ,
175+ Label(" __global_" , " %s" , Sanitise(global.name))
176+ );
175177 output ~= " add si, 2\n " ;
176- output ~= format(" call __type_deinit_%s\n " , Sanitise(global.type.name));
178+ output ~= format(
179+ " call __type_deinit_%s\n " , ExtLabel(
180+ global.type.mod, " __type_deinit_" , " %s" ,
181+ Sanitise(global.type.name)
182+ )
183+ );
177184 }
178185 }
179186
@@ -201,6 +208,8 @@ class BackendRM86 : CompilerBackend {
201208
202209 output.StartSection(SectionType.Data);
203210 foreach (var ; globals) {
211+ if (var.mod != output.GetModName()) continue ;
212+
204213 output ~= format(
205214 " %s: times %d db 0\n " ,
206215 Label(" __global_" , " %s" , var.name.Sanitise()), var.Size()
@@ -410,6 +419,10 @@ class BackendRM86 : CompilerBackend {
410419 else if (IsStructMember(node.name)) {
411420 string name = node.name[0 .. node.name.countUntil(" ." )];
412421 auto structVar = GetStructVariable(node, node.name);
422+
423+ if (CountAll(name)) {
424+ Error(node.error, " Multiple matches for identifier '%s'" , name);
425+ }
413426
414427 if (structVar.structure) {
415428 Error(node.error, " Can't push the value of an array or structure" );
0 commit comments