Пример #1
0
 protected void MergeTypes(TypeDefinerScopeImpl other)
 {
     foreach (var kv in other._types)
     {
         if (!_types.TryGetValue(kv.Key, out var my))
         {
             my = new TypeScopeImpl(Workspace, this);
             _types.Add(kv.Key, my);
         }
         my.MergeWith(kv.Value);
     }
 }
Пример #2
0
 internal void MergeWith(TypeScopeImpl other)
 {
     Debug.Assert(other != null);
     if (TypeKey != other.TypeKey)
     {
         throw new InvalidOperationException($"Unable to merge type '{_typeDef}' with '{other._typeDef}'.");
     }
     _typeDef.MergeWith(other._typeDef);
     CodePart.MergeWith(other.CodePart);
     MergeTypes(other);
     _funcs.MergeWith(Workspace, this, other._funcs);
 }
Пример #3
0
        public ITypeScope CreateType(Action <ITypeScope> header)
        {
            if (header == null)
            {
                throw new ArgumentNullException(nameof(header));
            }
            TypeScopeImpl typeScope = new TypeScopeImpl(Workspace, this);

            header(typeScope);
            typeScope.Initialize();
            _types.Add(typeScope.TypeKey, typeScope);
            Workspace.OnTypeCreated(typeScope);
            return(typeScope);
        }
Пример #4
0
 internal void OnTypeCreated(TypeScopeImpl t) => TypeCreated?.Invoke(t);