@@ -92,7 +92,7 @@ class BackendLinux86 : CompilerBackend {
9292 NewConst(" Array.sizeof" , 8 * 3 );
9393 }
9494
95- void NewConst (string name, long value, ErrorInfo error = ErrorInfo.init) {
95+ override void NewConst (string name, long value, ErrorInfo error = ErrorInfo.init) {
9696 consts[name] = Constant(new IntegerNode(error, value));
9797 }
9898
@@ -167,7 +167,7 @@ class BackendLinux86 : CompilerBackend {
167167 output ~= " section .bss\n " ;
168168
169169 foreach (name, var ; globals) {
170- output ~= format(" __global_%s: resb %d\n " , name, var.Size());
170+ output ~= format(" __global_%s: resb %d\n " , name.Sanitise() , var.Size());
171171 }
172172
173173 foreach (i, ref array ; arrays) {
@@ -522,6 +522,10 @@ class BackendLinux86 : CompilerBackend {
522522 }
523523
524524 override void CompileConst (ConstNode node) {
525+ if (node.name in consts) {
526+ Error(node.error, " Constant '%s' already defined" , node.name);
527+ }
528+
525529 NewConst(node.name, node.value);
526530 }
527531}
0 commit comments