private void ResolveNamespaces(IList <object> elements, IServiceProvider services) { var context = (ExpressionContext)services.GetService(typeof(ExpressionContext)); ImportBase currentImport = context.Imports.RootImport; while (true) { var name = GetName(elements); var flag = name == null; if (flag) { break; } var import = currentImport.FindImport(name); var flag2 = import == null; if (flag2) { break; } currentImport = import; elements.RemoveAt(0); var flag3 = elements.Count > 0; if (flag3) { var newFirst = (MemberElement)elements[0]; newFirst.SetImport(currentImport); } } var flag4 = elements.Count == 0; if (flag4) { this.ThrowCompileException("NamespaceCannotBeUsedAsType", CompileExceptionReason.TypeMismatch, currentImport.Name); } }
internal Type FindType(string[] typeNameParts) { var namespaces = new string[typeNameParts.Length - 2 + 1]; var typeName = typeNameParts[typeNameParts.Length - 1]; Array.Copy(typeNameParts, namespaces, namespaces.Length); ImportBase currentImport = this.RootImport; var array = namespaces; checked { for (var i = 0; i < array.Length; i++) { var ns = array[i]; currentImport = currentImport.FindImport(ns); var flag = currentImport == null; if (flag) { break; } } var flag2 = currentImport == null; var findType = flag2 ? null : currentImport.FindType(typeName); return(findType); } }
protected override bool EqualsInternal(ImportBase import) { var otherSameType = import as MethodImport; return(otherSameType != null && this.Target.MethodHandle.Equals(otherSameType.Target.MethodHandle)); }
protected override bool EqualsInternal(ImportBase import) { var otherSameType = import as TypeImport; return(otherSameType != null && this.Target == otherSameType.Target); }
public void SetImport(ImportBase import) { this.myImport = import; }