Пример #1
0
 public AliasedSymbol(string name, SymbolKinds kind, PapyrusSymbol aliasedSymbol, PapyrusSymbol parent)
     : base(aliasedSymbol.Definition, aliasedSymbol.Identifier, parent)
 {
     _name          = name;
     _kind          = kind;
     _aliasedSymbol = aliasedSymbol;
 }
Пример #2
0
        internal SymbolSpecificationDialog(SymbolSpecificationViewModel viewModel)
        {
            _viewModel = viewModel;
            InitializeComponent();
            DataContext = viewModel;

            SymbolKinds.AddHandler(UIElement.PreviewKeyDownEvent, (KeyEventHandler)HandleSymbolKindsPreviewKeyDown, true);
            Accessibilities.AddHandler(UIElement.PreviewKeyDownEvent, (KeyEventHandler)HandleAccessibilitiesPreviewKeyDown, true);
            Modifiers.AddHandler(UIElement.PreviewKeyDownEvent, (KeyEventHandler)HandleModifiersPreviewKeyDown, true);
        }
Пример #3
0
        public static IEnumerable <PapyrusSymbol> GetScriptMemberSymbols(
            this ScriptSymbol symbol,
            bool declaredOnly            = false,
            bool includeDeclaredPrivates = false,
            bool globalOnly = false,
            SymbolKinds additionalNonGlobalKinds = SymbolKinds.None)
        {
            var symbols = (IEnumerable <PapyrusSymbol>)symbol.Definition.ScopedSymbols.Values;

            if (!globalOnly)
            {
                var kindFilter = SymbolKinds.Property | SymbolKinds.Function | SymbolKinds.Event | SymbolKinds.Struct | SymbolKinds.Group;
                if (includeDeclaredPrivates)
                {
                    kindFilter |= SymbolKinds.Variable;
                }

                kindFilter |= additionalNonGlobalKinds;

                symbols = symbols.Where(s => (s.Flags & LanguageFlags.Global) == 0 && (s.Kind & kindFilter) != 0);
            }
            else
            {
                symbols = symbols.Where(s => (s.Flags & LanguageFlags.Global) != 0 && (s.Kind & SymbolKinds.Function) != 0);

                if (declaredOnly)
                {
                    symbols = symbols.Where(s => s.Script == symbol.Script);
                }
            }

            if (!declaredOnly)
            {
                var extendedScript = symbol.ExtendedScript;
                if (extendedScript != null)
                {
                    symbols = symbols.Concat(extendedScript.GetScriptMemberSymbols(globalOnly: globalOnly));
                }
            }

            return(symbols.DistinctBy(s => s.Name + "_" + s.Kind, StringComparer.OrdinalIgnoreCase));
        }
Пример #4
0
 public Symbol(SymbolKinds kind)
 {
     Kind = kind;
     Num  = 0;
     Pow  = 1;
 }
Пример #5
0
 public Symbol(SymbolKinds kind, decimal num, int pow)
 {
     Kind = kind;
     Num  = num;
     Pow  = pow;
 }
Пример #6
0
 public Symbol(SymbolKinds kind, decimal num)
 {
     Kind = kind;
     Num  = num;
     Pow  = 1;
 }
Пример #7
0
 public static void AssertAreOfKinds(this IEnumerable <PapyrusSymbol> symbols, SymbolKinds kinds)
 {
     Assert.IsTrue(symbols.All(
                       s => (s.Kind & kinds) != 0),
                   $"All symbols must be one of kinds {kinds}.");
 }