示例#1
0
文件: Scope.cs 项目: nnieslan/IL.View
    public void AddChild(Scope childScope)
    {
      if (childScope.Parent != null)
        throw new InvalidOperationException("The child scope already has a parent.");

      childScope.Parent = this;

      Children.Add(childScope);
    }
示例#2
0
    private static void AddScopeToNestedScopes(Scope scope, ref Scope currentScope, ICollection<Scope> capturedStyleTree)
    {
      if (scope.Index >= currentScope.Index && (scope.Index + scope.Length <= currentScope.Index + currentScope.Length))
      {
        currentScope.AddChild(scope);
        currentScope = scope;
      }
      else
      {
        currentScope = currentScope.Parent;

        if (currentScope != null)
          AddScopeToNestedScopes(scope, ref currentScope, capturedStyleTree);
        else
          capturedStyleTree.Add(scope);
      }
    }
示例#3
0
    private static void GetStyleInsertionsForCapturedStyle(Scope scope, ICollection<TextInsertion> styleInsertions)
    {
      styleInsertions.Add(new TextInsertion
      {
        Index = scope.Index,
        Scope = scope
      });

      foreach (Scope childScope in scope.Children)
        GetStyleInsertionsForCapturedStyle(childScope, styleInsertions);

      styleInsertions.Add(new TextInsertion
      {
        Index = scope.Index + scope.Length,
        //                Text = ""
      });
    }