public static PhpCompilation Create(
            string assemblyName,
            IEnumerable <PhpSyntaxTree> syntaxTrees     = null,
            IEnumerable <MetadataReference> references  = null,
            IEnumerable <ResourceDescription> resources = null,
            PhpCompilationOptions options = null)
        {
            Debug.Assert(options != null);

            var compilation = new PhpCompilation(
                assemblyName,
                options,
                ValidateReferences <CompilationReference>(references),
                false);

            compilation.SynthesizedResources = resources;

            compilation.CheckAssemblyName(compilation.DeclarationDiagnostics);

            compilation.SourceSymbolCollection.AddSyntaxTreeRange(syntaxTrees);

            //
            return(compilation);
        }
Beispiel #2
0
        private PhpCompilation Update(
            string assemblyName           = null,
            PhpCompilationOptions options = null,
            IEnumerable <MetadataReference> references = null,
            ReferenceManager referenceManager          = null,
            bool reuseReferenceManager = false,
            IEnumerable <PhpSyntaxTree> syntaxTrees = null)
        {
            var compilation = new PhpCompilation(
                assemblyName ?? this.AssemblyName,
                options ?? _options,
                references != null ? references.AsImmutable() : this.ExternalReferences,
                //this.PreviousSubmission,
                //this.SubmissionReturnType,
                //this.HostObjectType,
                this.IsSubmission,
                referenceManager ?? _referenceManager,
                reuseReferenceManager,
                EventQueue);

            compilation.SourceSymbolCollection.AddSyntaxTreeRange(syntaxTrees ?? SyntaxTrees);

            return(compilation);
        }
Beispiel #3
0
        private PhpCompilation(
            string assemblyName,
            PhpCompilationOptions options,
            ImmutableArray <MetadataReference> references,
            bool isSubmission,
            ReferenceManager referenceManager = null,
            bool reuseReferenceManager        = false,
            //SyntaxAndDeclarationManager syntaxAndDeclarations
            AsyncQueue <CompilationEvent> eventQueue = null
            )
            : base(assemblyName, references, SyntaxTreeCommonFeatures(ImmutableArray <SyntaxTree> .Empty), isSubmission, eventQueue)
        {
            _wellKnownMemberSignatureComparer = new WellKnownMembersSignatureComparer(this);

            _options              = options;
            _tables               = new SourceSymbolCollection(this);
            _coreTypes            = new CoreTypes(this);
            _coreMethods          = new CoreMethods(_coreTypes);
            _anonymousTypeManager = new AnonymousTypeManager(this);

            _referenceManager = (reuseReferenceManager && referenceManager != null)
                ? referenceManager
                : new ReferenceManager(MakeSourceAssemblySimpleName(), options.AssemblyIdentityComparer, referenceManager?.ObservedMetadata, options.SdkDirectory);
        }
Beispiel #4
0
 public PhpCompilation WithPhpOptions(PhpCompilationOptions options)
 {
     return(Update(options: options));
 }