+2002-12-06 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): I can only use the
+ Concat (string, string, string) and Concat (string, string,
+ string, string) if the child is actually a concatenation of
+ strings.
+
2002-12-04 Miguel de Icaza <miguel@ximian.com>
* cs-tokenizer.cs: Small fix, because decimal_digits is used in a
// String.Concat (string, string, string, string)
// if possible.
//
- if (b.oper == Operator.Addition){
+ if (b.oper == Operator.Addition &&
+ (b.method == TypeManager.string_concat_string_string_string ||
+ b.method == TypeManager.string_concat_string_string_string_string)){
ArrayList bargs = b.Arguments;
int count = bargs.Count;
if (left == null || right == null)
return null;
- if (left.Type == null)
- throw new Exception (
- "Resolve returned non null, but did not set the type! (" +
- left + ") at Line: " + loc.Row);
- if (right.Type == null)
- throw new Exception (
- "Resolve returned non null, but did not set the type! (" +
- right + ") at Line: "+ loc.Row);
-
eclass = ExprClass.Value;
- if (left is Constant && right is Constant){
+ Constant rc = right as Constant;
+ Constant lc = left as Constant;
+
+ if (rc != null & lc != null){
Expression e = ConstantFold.BinaryFold (
- ec, oper, (Constant) left, (Constant) right, loc);
- if (e != null)
- return e;
+ ec, oper, lc, rc, loc);
+ if (e != null)
+ return e;
}
return ResolveOperator (ec);
Namespace parent;
string name;
ArrayList using_clauses;
- Hashtable using_namespaces;
Hashtable aliases;
public bool DeclarationFound = false;
if (using_clauses == null)
using_clauses = new ArrayList ();
- if (using_namespaces == null)
- using_namespaces = new Hashtable ();
-
- if (using_namespaces.ContainsKey (ns)) {
- Report.Warning (105, loc, "The using directive for '" + ns +
- "' appeared previously in this namespace");
- return;
+ foreach (UsingEntry old_entry in using_clauses){
+ if (old_entry.Name == ns){
+ Report.Warning (105, loc, "The using directive for '" + ns +
+ "' appeared previously in this namespace");
+ break;
+ }
}
-
+
UsingEntry ue = new UsingEntry (ns, loc);
using_clauses.Add (ue);
- using_namespaces.Add (ns, ns);
}
public ArrayList UsingTable {