public ExitableNonScopeDefiningConstructDetails(CSharpName exitEarlyBooleanNameIfAny, ExitableNonScopeDefiningConstructOptions structureType)
            {
                if (!Enum.IsDefined(typeof(ExitableNonScopeDefiningConstructOptions), structureType))
                {
                    throw new ArgumentOutOfRangeException("structureType");
                }

                ExitEarlyBooleanNameIfAny = exitEarlyBooleanNameIfAny;
                StructureType             = structureType;
            }
Пример #2
0
        public OutermostScope(CSharpName wrapperName, NonNullImmutableList <ICodeBlock> codeBlocks)
        {
            if (wrapperName == null)
            {
                throw new ArgumentNullException("wrapperName");
            }
            if (codeBlocks == null)
            {
                throw new ArgumentNullException("codeBlocks");
            }

            Name = new DoNotRenameNameToken(wrapperName.Name, 0);
            AllExecutableBlocks = codeBlocks;
        }
            public DirectedWithReferenceDetails(CSharpName referenceName, int lineIndexOfWithStatement)
            {
                if (referenceName == null)
                {
                    throw new ArgumentNullException("referenceName");
                }
                if (lineIndexOfWithStatement < 0)
                {
                    throw new ArgumentOutOfRangeException("lineIndexOfWithStatement");
                }

                ReferenceName             = referenceName;
                _lineIndexOfWithStatement = lineIndexOfWithStatement;
            }
        public static ScopeAccessInformation FromOutermostScope(
            CSharpName outermostScopeWrapperName,
            NonNullImmutableList <ICodeBlock> blocks,
            NonNullImmutableList <NameToken> externalDependencies)
        {
            if (outermostScopeWrapperName == null)
            {
                throw new ArgumentNullException("outermostScopeWrapperName");
            }
            if (blocks == null)
            {
                throw new ArgumentNullException("blocks");
            }
            if (externalDependencies == null)
            {
                throw new ArgumentNullException("externalDependencies");
            }

            // This prepares the empty template for the primary instance..
            var outermostScope = new OutermostScope(outermostScopeWrapperName, blocks);
            var initialScope   = new ScopeAccessInformation(
                outermostScope,                               // parent
                outermostScope,                               // scope-defining parent
                null,                                         // parentReturnValueNameIfAny
                null,                                         // errorRegistrationTokenIfAny
                null,                                         // directedWithReferenceIfAn
                externalDependencies,
                new NonNullImmutableList <ScopedNameToken>(), // classes
                new NonNullImmutableList <ScopedNameToken>(), // functions,
                new NonNullImmutableList <ScopedNameToken>(), // properties,
                new NonNullImmutableList <ScopedNameToken>(), // constants
                new NonNullImmutableList <ScopedNameToken>(), // variables
                new NonNullImmutableList <ExitableNonScopeDefiningConstructDetails>()
                );

            // .. but it needs the classes, functions, properties and variables declared by the code blocks to be registered with it. To do that, this
            // extension method will be used (seems a bit strange since this method is part of the ScopeAccessInformation class and it relies upon an
            // extension method, but that's only because there's no way to define a static extension method, which would have been ideal for this).
            return(initialScope.Extend(outermostScope, blocks));
        }
        public ScopeAccessInformation(
            IHaveNestedContent parent,
            IDefineScope scopeDefiningParent,
            CSharpName parentReturnValueNameIfAny,
            CSharpName errorRegistrationTokenIfAny,
            DirectedWithReferenceDetails directedWithReferenceIfAny,
            NonNullImmutableList <NameToken> externalDependencies,
            NonNullImmutableList <ScopedNameToken> classes,
            NonNullImmutableList <ScopedNameToken> functions,
            NonNullImmutableList <ScopedNameToken> properties,
            NonNullImmutableList <ScopedNameToken> constants,
            NonNullImmutableList <ScopedNameToken> variables,
            NonNullImmutableList <ExitableNonScopeDefiningConstructDetails> structureExitPoints)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (scopeDefiningParent == null)
            {
                throw new ArgumentNullException("scopeDefiningParent");
            }
            if (externalDependencies == null)
            {
                throw new ArgumentNullException("externalDependencies");
            }
            if (classes == null)
            {
                throw new ArgumentNullException("classes");
            }
            if (functions == null)
            {
                throw new ArgumentNullException("functions");
            }
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }
            if (constants == null)
            {
                throw new ArgumentNullException("constants");
            }
            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }
            if (structureExitPoints == null)
            {
                throw new ArgumentNullException("structureExitPoints");
            }

            Parent = parent;
            ScopeDefiningParent         = scopeDefiningParent;
            ParentReturnValueNameIfAny  = parentReturnValueNameIfAny;
            ErrorRegistrationTokenIfAny = errorRegistrationTokenIfAny;
            DirectedWithReferenceIfAny  = directedWithReferenceIfAny;
            ExternalDependencies        = externalDependencies;
            Classes             = classes;
            Functions           = functions;
            Properties          = properties;
            Constants           = constants;
            Variables           = variables;
            StructureExitPoints = structureExitPoints;
        }