Beispiel #1
0
        public override void ResolveReferences(IFiction context)
        {
            base.ResolveReferences(context);

            if (name != null && name.Length > 0)
            {
                context.CheckForNamingCollisions(this, name, SymbolType.SubFlowAndWeave);
            }
        }
        public override void ResolveReferences(IFiction context)
        {
            if (_startingSubFlowDivert)
            {
                _startingSubFlowDivert.targetPath = _startingSubFlowRuntime.path;
            }

            base.ResolveReferences(context);

            // Check validity of parameter names
            if (arguments != null)
            {
                foreach (var arg in arguments)
                {
                    context.CheckForNamingCollisions(this, arg.name, SymbolType.Arg, "argument");
                }

                // Separately, check for duplicate arugment names, since they aren't Parsed.Objects,
                // so have to be checked independently.
                for (int i = 0; i < arguments.Count; i++)
                {
                    for (int j = i + 1; j < arguments.Count; j++)
                    {
                        if (arguments [i].name == arguments [j].name)
                        {
                            Error("Multiple arguments with the same name: '" + arguments [i].name + "'");
                        }
                    }
                }
            }

            // Check naming collisions for knots and stitches
            if (flowLevel != FlowLevel.Story)
            {
                // Weave points aren't FlowBases, so this will only be knot or stitch
                var symbolType = flowLevel == FlowLevel.Knot ? SymbolType.Knot : SymbolType.SubFlowAndWeave;
                context.CheckForNamingCollisions(this, name, symbolType);
            }
        }
        public override void ResolveReferences(IFiction context)
        {
            base.ResolveReferences(context);

            // List definitions are checked for conflicts separately
            if (this.isDeclaration && listDefinition == null)
            {
                context.CheckForNamingCollisions(this, variableName, this.isGlobalDeclaration ? SymbolType.Var : SymbolType.Temp);
            }

            // Initial VAR x = [intialValue] declaration, not re-assignment
            if (this.isGlobalDeclaration)
            {
                var variableReference = expression as VariableReference;
                if (variableReference && !variableReference.isConstantReference && !variableReference.isListItemReference)
                {
                    Error("global variable assignments cannot refer to other variables, only literal values, constants and list items");
                }
            }

            if (!this.isNewTemporaryDeclaration)
            {
                var resolvedVarAssignment = context.ResolveVariableWithName(this.variableName, fromNode: this);
                if (!resolvedVarAssignment.found)
                {
                    if (ParsedFiction.constants.ContainsKey(variableName))
                    {
                        Error("Can't re-assign to a constant (do you need to use VAR when declaring '" + this.variableName + "'?)", this);
                    }
                    else
                    {
                        Error("Variable could not be found to assign to: '" + this.variableName + "'", this);
                    }
                }

                // A runtime assignment may not have been generated if it's the initial global declaration,
                // since these are hoisted out and handled specially in Story.ExportRuntime.
                if (_runtimeAssignment != null)
                {
                    _runtimeAssignment.isGlobal = resolvedVarAssignment.isGlobal;
                }
            }
        }
Beispiel #4
0
        public override void ResolveReferences(IFiction context)
        {
            // Weave style choice - target own content container
            if (_innerContentContainer)
            {
                _runtimeChoice.pathOnChoice = _innerContentContainer.path;

                if (onceOnly)
                {
                    _innerContentContainer.visitsShouldBeCounted = true;
                }
            }

            if (_returnToR1)
            {
                _returnToR1.targetPath = _r1Label.path;
            }

            if (_returnToR2)
            {
                _returnToR2.targetPath = _r2Label.path;
            }

            if (_divertToStartContentOuter)
            {
                _divertToStartContentOuter.targetPath = _startContentRuntimeContainer.path;
            }

            if (_divertToStartContentInner)
            {
                _divertToStartContentInner.targetPath = _startContentRuntimeContainer.path;
            }

            base.ResolveReferences(context);

            if (name != null && name.Length > 0)
            {
                context.CheckForNamingCollisions(this, name, SymbolType.SubFlowAndWeave);
            }
        }
        public override void ResolveReferences(IFiction context)
        {
            base.ResolveReferences(context);

            context.CheckForNamingCollisions(this, name, SymbolType.List);
        }