Example #1
0
    /// <summary>
    /// 添加脚本
    /// </summary>
    /// <param name="script"></param>
    public AssemblyCSharpBuilder Add(string script)
    {
        var tree      = NatashaCSharpSyntax.ParseTree(script, _options);
        var exception = NatashaExceptionAnalyzer.GetSyntaxException(tree);

        if (exception != null)
        {
            throw exception;
        }
        else
        {
            lock (SyntaxTrees)
            {
                SyntaxTrees.Add(tree);
            }
        }
        return(this);
    }