コード例 #1
0
        private Symbol ValidateFunctionFlags(Symbol symbol, TextSpan span)
        {
            if (!(symbol is FunctionSymbol functionSymbol))
            {
                return(symbol);
            }

            var functionFlags = functionSymbol.Overloads.Select(overload => overload.Flags).Aggregate((x, y) => x | y);

            if (functionFlags.HasFlag(FunctionFlags.ParamDefaultsOnly) && !allowedFlags.HasFlag(FunctionFlags.ParamDefaultsOnly))
            {
                return(new ErrorSymbol(DiagnosticBuilder.ForPosition(span).FunctionOnlyValidInParameterDefaults(functionSymbol.Name)));
            }

            if (functionFlags.HasFlag(FunctionFlags.RequiresInlining) && !allowedFlags.HasFlag(FunctionFlags.RequiresInlining))
            {
                return(new ErrorSymbol(DiagnosticBuilder.ForPosition(span).FunctionOnlyValidInResourceBody(functionSymbol.Name)));
            }

            return(symbol);
        }
コード例 #2
0
ファイル: ME3Function.cs プロジェクト: Mgamerz/ME3Libs
        public override bool Deserialize()
        {
            var result = base.Deserialize();

            NativeToken = Data.ReadUInt16();

            //OperatorPrecedence = Data.ReadByte(); // Does not appear in ME3?

            FunctionFlags = (FunctionFlags)Data.ReadInt32();

            if (FunctionFlags.HasFlag(FunctionFlags.Net))
            {
                ReplicateOffset = Data.ReadUInt16();
            }

            return(result);
        }
コード例 #3
0
 public NameReference FriendlyName; //ME1/2
 protected override void Serialize(SerializingContainer2 sc)
 {
     base.Serialize(sc);
     sc.Serialize(ref NativeIndex);
     if (sc.Game <= MEGame.ME2)
     {
         sc.Serialize(ref OperatorPrecedence);
     }
     sc.Serialize(ref FunctionFlags);
     if (sc.Game <= MEGame.ME2 && FunctionFlags.HasFlag(FunctionFlags.Net))
     {
         sc.Serialize(ref ReplicationOffset);
     }
     if (sc.Game <= MEGame.ME2)
     {
         sc.Serialize(ref FriendlyName);
     }
 }
コード例 #4
0
 public NameReference FriendlyName; //ME1/2
 protected override void Serialize(SerializingContainer2 sc)
 {
     base.Serialize(sc);
     sc.Serialize(ref NativeIndex);
     if (sc.Game <= MEGame.ME2) //This is present on PS3 ME1/ME2 but not ME3 for some reason.
     {
         sc.Serialize(ref OperatorPrecedence);
     }
     sc.Serialize(ref FunctionFlags);
     if (sc.Game <= MEGame.ME2 && sc.Pcc.Platform != MEPackage.GamePlatform.PS3 && FunctionFlags.HasFlag(FunctionFlags.Net))
     {
         sc.Serialize(ref ReplicationOffset);
     }
     if (sc.Game <= MEGame.ME2 && sc.Pcc.Platform != MEPackage.GamePlatform.PS3)
     {
         sc.Serialize(ref FriendlyName);
     }
 }