예제 #1
0
        ExpressionNode GetId(CodeString Code, bool EnableMessages,
                             OverloadSelectionData OverloadData = new OverloadSelectionData(), IdContainer Container = null)
        {
            if (Container == null)
            {
                Container = this.Container;
            }

            var Options = GetIdOptions.Default;

            Options.OverloadData   = OverloadData;
            Options.EnableMessages = EnableMessages;

            var Id = Container.RecognizeIdentifier(Code, Options);

            if (Id == null)
            {
                return(null);
            }

            if (Id is Constructor)
            {
                if (Container.Parent == null)
                {
                    throw new ApplicationException();
                }
                return(GetId(Code, EnableMessages, OverloadData, Container.Parent));
            }

            return(Expressions.CreateReference(Container, Id, Parent, Code, EnableMessages));
        }
예제 #2
0
        public ExpressionNode DeclareVarAndCreateIdNode(CodeString Code, CodeString TypeName, CodeString Name)
        {
            var Type = Container.RecognizeIdentifier(TypeName, GetIdOptions.DefaultForType);

            if (Type == null)
            {
                return(null);
            }

            return(DeclareVarAndCreateIdNode(Code, Type, Name));
        }
예제 #3
0
        public SimpleRecResult Declare()
        {
            var Options = new GetIdOptions(GetIdMode.Everywhere, false);
            var Id      = Container.RecognizeIdentifier(OldName, Options);

            if (Id == null)
            {
                return(SimpleRecResult.Unknown);
            }

            var Alias = new IdentifierAlias(Container, NewName, Id);

            if (Mods != null && !Modifiers.Apply(Mods, Alias))
            {
                return(SimpleRecResult.Failed);
            }

            if (!Container.DeclareIdentifier(Alias))
            {
                return(SimpleRecResult.Failed);
            }

            return(SimpleRecResult.Succeeded);
        }