comparison dmd/BinExp.d @ 176:fa9a71a9f5a8

Moved all the mutable globals to Global
author korDen
date Sun, 10 Oct 2010 05:22:45 +0400
parents 94b6033c07f3
children e3afd1303184
comparison
equal deleted inserted replaced
175:94b6033c07f3 176:fa9a71a9f5a8
16 import dmd.Declaration; 16 import dmd.Declaration;
17 import dmd.StructLiteralExp; 17 import dmd.StructLiteralExp;
18 import dmd.Expression; 18 import dmd.Expression;
19 import dmd.interpret.Util; 19 import dmd.interpret.Util;
20 import dmd.GlobalExpressions; 20 import dmd.GlobalExpressions;
21 import dmd.Global;
21 import dmd.Cast; 22 import dmd.Cast;
22 import dmd.CastExp; 23 import dmd.CastExp;
23 import dmd.VarDeclaration; 24 import dmd.VarDeclaration;
24 import dmd.DotVarExp; 25 import dmd.DotVarExp;
25 import dmd.Loc; 26 import dmd.Loc;
95 96
96 /************************************** 97 /**************************************
97 * Hash table of array op functions already generated or known about. 98 * Hash table of array op functions already generated or known about.
98 */ 99 */
99 100
100 __gshared StringTable arrayfuncs;
101
102 int typeMerge(Scope sc, Expression e, Type* pt, Expression* pe1, Expression* pe2) 101 int typeMerge(Scope sc, Expression e, Type* pt, Expression* pe1, Expression* pe2)
103 { 102 {
104 //printf("typeMerge() %.*s op %.*s\n", (*pe1).toChars(), (*pe2).toChars()); 103 //printf("typeMerge() %.*s op %.*s\n", (*pe1).toChars(), (*pe2).toChars());
105 //dump(0); 104 //dump(0);
106 105
1484 buf.writeByte(0); 1483 buf.writeByte(0);
1485 immutable(char)* name = cast(immutable(char)*)buf.extractData(); 1484 immutable(char)* name = cast(immutable(char)*)buf.extractData();
1486 1485
1487 /* Look up name in hash table 1486 /* Look up name in hash table
1488 */ 1487 */
1489 if (arrayfuncs is null) arrayfuncs = new StringTable(); /// HACK! 1488 StringValue* sv = global.arrayfuncs.update(name[0..namelen]);
1490
1491 StringValue* sv = arrayfuncs.update(name[0..namelen]);
1492 FuncDeclaration fd = cast(FuncDeclaration)sv.ptrvalue; 1489 FuncDeclaration fd = cast(FuncDeclaration)sv.ptrvalue;
1493 if (!fd) 1490 if (!fd)
1494 { 1491 {
1495 /* Some of the array op functions are written as library functions, 1492 /* Some of the array op functions are written as library functions,
1496 * presumably to optimize them with special CPU vector instructions. 1493 * presumably to optimize them with special CPU vector instructions.