Example #1
0
 public Parameter(ISignature signature, string name, string documentation, Span locus)
 {
     Signature = signature;
     Name = name;
     Documentation = documentation;
     Locus = locus;
 }
Example #2
0
 public PythonParameter(ISignature signature, ParameterResult param, Span locus, Span ppLocus) {
     _signature = signature;
     _param = param;
     _locus = locus;
     _ppLocus = ppLocus;
     _documentation = _param.Documentation.LimitLines(15, stopAtFirstBlankLine: true);
 }
Example #3
0
 public SparkTagParameter(string documentation, Span span, string name, ISignature signature)
 {
     Documentation = documentation;
     Locus = span;
     Name = name;
     Signature = signature;
 }
Example #4
0
 public NodejsParameter(ISignature signature, ParameterResult param, Span locus, Span ppLocus, string documentation = null) {
     _signature = signature;
     _param = param;
     _locus = locus;
     _ppLocus = ppLocus;
     _documentation = (documentation ?? _param.Documentation).LimitLines(15, stopAtFirstBlankLine: true);
 }
 public Parameter(string documentation, Span locus, string name, ISignature signature)
 {
     Documentation = documentation;
     Locus = locus;
     Name = name;
     Signature = signature;
 }
 void sigs_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {
     if (e.Action != NotifyCollectionChangedAction.Add) {
         throw new NotImplementedException();
     }
     if (_active == null) {
         _active = _sigs[0];
     }
 }
Example #7
0
 public PythonParameter(ISignature signature, AP.Parameter param, Span locus, Span ppLocus, AnalysisVariable[] variables) {
     _signature = signature;
     _param = param;
     _locus = locus;
     _ppLocus = ppLocus;
     _documentation = _param.doc.LimitLines(15, stopAtFirstBlankLine: true);
     _variables = variables;
 }
 public SignatureParameter(string documentation, Span locus, Span prettyPrintedLocus, string name, ISignature signature)
 {
     Documentation = documentation;
     Locus = locus;
     PrettyPrintedLocus = prettyPrintedLocus;
     Name = name;
     Signature = signature;
 }
        public SignatureWrapper(ISignature signature)
        {
            if (signature == null) 
                return;

            Id = signature.Id;
            DatabaseId = signature.DatabaseId;
            PositionId = signature.PositionId;
            Role = signature.Role;
            Sign = signature.Sign;
            RequestedSigner = signature.RequestedSigner;
        }
Example #10
0
 public Parameter(
     Signature signature,
     SignatureHelpParameter parameter,
     string content,
     int index,
     int prettyPrintedIndex)
 {
     _parameter = parameter;
     this.Signature = signature;
     _contentLength = content.Length;
     _index = index;
     _prettyPrintedIndex = prettyPrintedIndex;
 }
Example #11
0
        public Parameter(
            Signature signature,
            SignatureHelpParameter parameter,
            string content,
            int index,
            int prettyPrintedIndex)
        {
            this.Signature = signature;
            this.Name = parameter.Name;
            this.Documentation = parameter.Documentation.GetFullText();

            this.Locus = new Span(index, content.Length);
            this.PrettyPrintedLocus = new Span(prettyPrintedIndex, content.Length);
        }
Example #12
0
 //string documentation, Span locus, string name, ISignature signature
 internal NSSigParameter(Span trackingspan, string content, string prettyprintedcontent, string documentation, ISignature sig)
 {
     //public NSSigParameter(string Documentation, Span Locus, string Name, Span PPLocus, ISignature Signature) {
     m_trackingspan         = trackingspan;
     m_content              = content;
     m_prettyprintedcontent = prettyprintedcontent;
     m_documentation        = documentation;
     m_pplocus              = new Span();
     m_sig = sig;
     //m_trackingspan = trackingspan;
     //m_content = content;
     //m_prettyprintedcontent = prettyprintedcontent;
     //m_documentation = documentation;
     //PrettyPrintedLocus = PPLocus;
     //m_sig = sig;
 }
 private Type[] GetParameterTypes(ISignature signature, out Type[][] ptReqMods, out Type[][] ptOptMods) {
   uint numPars = IteratorHelper.EnumerableCount(signature.Parameters); //signature.ParameterCount;
   Type[] parameterTypes = new Type[numPars];
   ptReqMods = null;
   ptOptMods = null;
   int parameterCounter = 0;
   foreach (var parameter in signature.Parameters) {
     var pType = this.loader.mapper.GetType(parameter.Type);
     if (pType == null) {
       //TODO: error
       pType = typeof(object);
     }
     parameterTypes[parameterCounter] = pType;
     if (parameter.IsModified) {
       if (ptReqMods == null) {
         ptReqMods = new Type[numPars][];
         ptOptMods = new Type[numPars][];
       }
       this.GetModifierTypes(parameter.CustomModifiers, out ptReqMods[parameterCounter], out ptOptMods[parameterCounter]);
     }
     parameterCounter++;
   }
   return parameterTypes;
 }
 public RobotsTxtParameter(string documentation, Span locus, string name, ISignature signature)
 {
     this.Documentation = documentation;
     this.Locus = locus;
     this.Name = name;
     this.Signature = signature;
 }
Example #15
0
 public ApiRequest(ISignature signature)
 {
     _signature = signature;
     _client = new HttpClient();
 }
 internal static string SignatureDefinition(IUnit currentUnit, ISignature signatureDefinition) {
   StringBuilder sb = new StringBuilder();
   sb.Append(Helper.TypeDefinition(currentUnit, signatureDefinition.Type.ResolvedType));
   sb.Append("(");
   bool isNotFirst = false;
   foreach (IParameterDefinition paramDef in signatureDefinition.Parameters) {
     if (isNotFirst) {
       sb.Append(",");
     }
     isNotFirst = true;
     sb.Append(Helper.TypeDefinition(currentUnit, paramDef.Type.ResolvedType));
     if (paramDef.IsByReference)
       sb.Append("&");
   }
   sb.Append(")");
   return sb.ToString();
 }
Example #17
0
    public SignatureAppendedWithContracts(ISignature original, ITextBuffer textBuffer, string contracts) {
      Contract.Requires(original != null);
      Contract.Requires(textBuffer != null);
      Contract.Requires(!String.IsNullOrEmpty(contracts));

      _textBuffer = textBuffer;
      _applicableToSpan = original.ApplicableToSpan;
      _content = original.Content;
      _currentParameter = original.CurrentParameter;
      _documentation = original.Documentation + "\n" + contracts;
      _prettyPrintedContent = original.PrettyPrintedContent;
      _parameters = original.Parameters;

#if false
      _textBuffer.Changed += OnTextBufferChanged;
      var newParameters = new List<IParameter>();
      foreach (var param in original.Parameters)
        newParameters.Add(new ParameterWithNewSignature(param, this));
      _parameters = newParameters.AsReadOnly();

      CalculateCurrentParameter();
#endif
    }
 public void Add(ISignature signature) => _nestedSignatures.Add(signature);
Example #19
0
        /// <summary>
        /// Emits the specified number of operations from the original method body.
        /// </summary>
        /// <param name="count"></param>
        public void EmitOperations(int count)
        {
            for (int i = 0; i < count; i++)
            {
                IOperation op = operations[0];
                operations.RemoveAt(0);
                ILGeneratorLabel label;
                if (op.Location is IILLocation)
                {
                    MarkSequencePoint(op.Location);
                }

                // Mark operation if it is a label for a branch
                if (offset2Label.TryGetValue(op.Offset, out label))
                {
                    MarkLabel(label);
                }

                // Mark operation if it is pointed to by an exception handler
                bool ignore;
                uint offset = op.Offset;
                if (offsetsUsedInExceptionInformation.TryGetValue(offset, out ignore))
                {
                    foreach (var exceptionInfo in methodBody.OperationExceptionInformation)
                    {
                        if (offset == exceptionInfo.TryStartOffset)
                        {
                            BeginTryBody();
                        }

                        // Never need to do anthing when offset == exceptionInfo.TryEndOffset because
                        // we pick up an EndTryBody from the HandlerEndOffset below
                        //  EndTryBody();

                        if (offset == exceptionInfo.HandlerStartOffset)
                        {
                            switch (exceptionInfo.HandlerKind)
                            {
                            case HandlerKind.Catch:
                                BeginCatchBlock(exceptionInfo.ExceptionType);
                                break;

                            case HandlerKind.Fault:
                                BeginFaultBlock();
                                break;

                            case HandlerKind.Filter:
                                BeginFilterBody();
                                break;

                            case HandlerKind.Finally:
                                BeginFinallyBlock();
                                break;
                            }
                        }

                        if (exceptionInfo.HandlerKind == HandlerKind.Filter && offset == exceptionInfo.FilterDecisionStartOffset)
                        {
                            BeginFilterBlock();
                        }

                        if (offset == exceptionInfo.HandlerEndOffset)
                        {
                            EndTryBody();
                        }
                    }
                }

                // Emit operation along with any injection
                switch (op.OperationCode)
                {
                // Branches
                case OperationCode.Beq:
                case OperationCode.Bge:
                case OperationCode.Bge_Un:
                case OperationCode.Bgt:
                case OperationCode.Bgt_Un:
                case OperationCode.Ble:
                case OperationCode.Ble_Un:
                case OperationCode.Blt:
                case OperationCode.Blt_Un:
                case OperationCode.Bne_Un:
                case OperationCode.Br:
                case OperationCode.Brfalse:
                case OperationCode.Brtrue:
                case OperationCode.Leave:
                case OperationCode.Beq_S:
                case OperationCode.Bge_S:
                case OperationCode.Bge_Un_S:
                case OperationCode.Bgt_S:
                case OperationCode.Bgt_Un_S:
                case OperationCode.Ble_S:
                case OperationCode.Ble_Un_S:
                case OperationCode.Blt_S:
                case OperationCode.Blt_Un_S:
                case OperationCode.Bne_Un_S:
                case OperationCode.Br_S:
                case OperationCode.Brfalse_S:
                case OperationCode.Brtrue_S:
                case OperationCode.Leave_S:
                    Emit(ILGenerator.LongVersionOf(op.OperationCode), offset2Label[(uint)op.Value]);
                    break;

                case OperationCode.Switch:
                    uint[]             offsets = op.Value as uint[];
                    ILGeneratorLabel[] labels  = new ILGeneratorLabel[offsets.Length];
                    for (int j = 0, n = offsets.Length; j < n; j++)
                    {
                        labels[j] = offset2Label[offsets[j]];
                    }
                    Emit(OperationCode.Switch, labels);
                    break;

                // Everything else
                default:
                    if (op.Value == null)
                    {
                        Emit(op.OperationCode);
                        break;
                    }
                    var typeCode = System.Convert.GetTypeCode(op.Value);
                    switch (typeCode)
                    {
                    case TypeCode.Byte:
                        Emit(op.OperationCode, (byte)op.Value);
                        break;

                    case TypeCode.Double:
                        Emit(op.OperationCode, (double)op.Value);
                        break;

                    case TypeCode.Int16:
                        Emit(op.OperationCode, (short)op.Value);
                        break;

                    case TypeCode.Int32:
                        Emit(op.OperationCode, (int)op.Value);
                        break;

                    case TypeCode.Int64:
                        Emit(op.OperationCode, (long)op.Value);
                        break;

                    case TypeCode.Object:
                        IFieldReference fieldReference = op.Value as IFieldReference;
                        if (fieldReference != null)
                        {
                            Emit(op.OperationCode, fieldReference);
                            break;
                        }
                        ILocalDefinition localDefinition = op.Value as ILocalDefinition;
                        if (localDefinition != null)
                        {
                            Emit(op.OperationCode, localDefinition);
                            break;
                        }
                        IMethodReference methodReference = op.Value as IMethodReference;
                        if (methodReference != null)
                        {
                            Emit(op.OperationCode, methodReference);
                            break;
                        }
                        IParameterDefinition parameterDefinition = op.Value as IParameterDefinition;
                        if (parameterDefinition != null)
                        {
                            Emit(op.OperationCode, parameterDefinition);
                            break;
                        }
                        ISignature signature = op.Value as ISignature;
                        if (signature != null)
                        {
                            Emit(op.OperationCode, signature);
                            break;
                        }
                        ITypeReference typeReference = op.Value as ITypeReference;
                        if (typeReference != null)
                        {
                            Emit(op.OperationCode, typeReference);
                            break;
                        }
                        throw new Exception("Should never get here: no other IOperation argument types should exist");

                    case TypeCode.SByte:
                        Emit(op.OperationCode, (sbyte)op.Value);
                        break;

                    case TypeCode.Single:
                        Emit(op.OperationCode, (float)op.Value);
                        break;

                    case TypeCode.String:
                        Emit(op.OperationCode, (string)op.Value);
                        break;

                    default:
                        throw new Exception("Should never get here: no other IOperation argument types should exist");
                    }
                    break;
                }
            }
        }
 public bool Verify(ISignature signature, byte[] message, byte[] context)
 {
     return(NativeBinding.StdVerify(signature.SignatureBytes, signature.PublicKeyBytes, message, context));
 }
Example #21
0
		void Caret_PositionChanged(object sender, CaretPositionChangedEventArgs e) {
			if (IsDismissed)
				return;
			var caretPos = TextView.Caret.Position;
			List<int> sigsToRemove = null;
			for (int i = 0; i < signatures.Count; i++) {
				if (!IsInSignature(signatures[i], caretPos)) {
					if (sigsToRemove == null)
						sigsToRemove = new List<int>();
					sigsToRemove.Add(i);
				}
			}
			if (sigsToRemove != null) {
				for (int i = sigsToRemove.Count - 1; i >= 0; i--)
					signatures.RemoveAt(sigsToRemove[i]);
			}
			if (signatures.Count == 0)
				Dismiss();
			else {
				Match();
				if (!signatures.Contains(SelectedSignature))
					SelectedSignature = signatures.FirstOrDefault();
			}
		}
Example #22
0
		public bool Match() {
			if (!IsStarted)
				throw new InvalidOperationException();
			if (IsDismissed)
				throw new InvalidOperationException();

			foreach (var source in signatureHelpSources) {
				var signature = source.GetBestMatch(this);
				if (signature != null) {
					SelectedSignature = signature;
					return true;
				}
			}

			return false;
		}
Example #23
0
        /// <summary>
        /// This method is the workhorse that does the rewrite of the IOperation op.
        /// </summary>
        /// <param name="op">The MSIL operation to rewrite.</param>
        protected void RewriteOpertation(IOperation op)
        {
            Contract.Requires(this.generator != null);
            Contract.Requires(op != null);

            if (op.Value == null)
            {
                generator.Emit(op.OperationCode);
                return;
            }
            var typeCode = System.Convert.GetTypeCode(op.Value);

            switch (typeCode)
            {
            case TypeCode.Byte:
                this.generator.Emit(op.OperationCode, (byte)op.Value);
                break;

            case TypeCode.Double:
                this.generator.Emit(op.OperationCode, (double)op.Value);
                break;

            case TypeCode.Int16:
                this.generator.Emit(op.OperationCode, (short)op.Value);
                break;

            case TypeCode.Int32:
                this.generator.Emit(op.OperationCode, (int)op.Value);
                break;

            case TypeCode.Int64:
                this.generator.Emit(op.OperationCode, (long)op.Value);
                break;

            case TypeCode.Object:
                IFieldReference fieldReference = op.Value as IFieldReference;
                if (fieldReference != null)
                {
                    this.generator.Emit(op.OperationCode, fieldReference);
                    break;
                }
                ILocalDefinition localDefinition = op.Value as ILocalDefinition;
                if (localDefinition != null)
                {
                    this.generator.Emit(op.OperationCode, localDefinition);
                    break;
                }
                IMethodReference methodReference = op.Value as IMethodReference;
                if (methodReference != null)
                {
                    this.generator.Emit(op.OperationCode, methodReference);
                    break;
                }
                IParameterDefinition parameterDefinition = op.Value as IParameterDefinition;
                if (parameterDefinition != null)
                {
                    this.generator.Emit(op.OperationCode, parameterDefinition);
                    break;
                }
                ISignature signature = op.Value as ISignature;
                if (signature != null)
                {
                    this.generator.Emit(op.OperationCode, signature);
                    break;
                }
                ITypeReference typeReference = op.Value as ITypeReference;
                if (typeReference != null)
                {
                    this.generator.Emit(op.OperationCode, typeReference);
                    break;
                }
                throw new Exception("Should never get here: no other IOperation argument types should exist");

            case TypeCode.SByte:
                this.generator.Emit(op.OperationCode, (sbyte)op.Value);
                break;

            case TypeCode.Single:
                this.generator.Emit(op.OperationCode, (float)op.Value);
                break;

            case TypeCode.String:
                this.generator.Emit(op.OperationCode, (string)op.Value);
                break;

            default:
                // The other cases are the other enum values that TypeCode has.
                // But no other argument types should be in the Operations. ILGenerator cannot handle anything else,
                // so such IOperations should never exist.
                //case TypeCode.Boolean:
                //case TypeCode.Char:
                //case TypeCode.DateTime:
                //case TypeCode.DBNull:
                //case TypeCode.Decimal:
                //case TypeCode.Empty: // this would be the value for null, but the case when op.Value is null is handled before the switch statement
                //case TypeCode.UInt16:
                //case TypeCode.UInt32:
                //case TypeCode.UInt64:
                throw new Exception("Should never get here: no other IOperation argument types should exist");
            }
        }
 public SignatureQueryAttribute(ISignature signature)
 {
     this.Signature = signature;
 }
Example #25
0
      public SignatureWithContracts(ISignature original, string contracts)
      {
          Contract.Requires(original != null);
          Contract.Requires(!String.IsNullOrEmpty(contracts));

          this.underlying = original;
          this.contracts = contracts;
      }
Example #26
0
 public VccFunctionPointerType(NameDeclaration name, ISignature signature, IInternFactory internFactory)
     : base(signature, internFactory)
 {
     this.name = name;
 }
Example #27
0
 protected IModuleParameter[] GetModuleParameters(
   bool useParamInfo,
   ISignature signatureDefinition,
   int paramCount
 ) {
   MethodDefinition/*?*/ moduleMethod = signatureDefinition as MethodDefinition;
   int paramIndex = 0;
   List<IModuleParameter> moduleParamList = new List<IModuleParameter>();
   while (paramIndex < paramCount) {
     bool dummyPinned;
     EnumerableArrayWrapper<CustomModifier, ICustomModifier> customModifiers = this.GetCustomModifiers(out dummyPinned);
     byte currByte = this.SignatureMemoryReader.PeekByte(0);
     if (currByte == ElementType.Sentinel) {
       this.SignatureMemoryReader.SkipBytes(1);
       break;
     }
     bool isByReference = false;
     IModuleTypeReference/*?*/ typeReference;
     if (currByte == ElementType.TypedReference) {
       this.SignatureMemoryReader.SkipBytes(1);
       typeReference = this.PEFileToObjectModel.SystemTypedReference;
     } else {
       if (currByte == ElementType.ByReference) {
         this.SignatureMemoryReader.SkipBytes(1);
         isByReference = true;
       }
       typeReference = this.GetTypeReference();
     }
     ParamInfo? paramInfo = useParamInfo ? this.GetParamInfo(paramIndex + 1) : null;
     IModuleParameter moduleParameter;
     if (paramInfo.HasValue) {
       //^ assert moduleMethod != null;
       moduleParameter =
         new ParameterWithMetadata(
           this.PEFileToObjectModel,
           paramIndex,
           customModifiers,
           typeReference,
           moduleMethod,
           isByReference,
           (paramIndex == paramCount - 1) && (typeReference is VectorType),
           paramInfo.Value.ParamRowId,
           paramInfo.Value.ParamName,
           paramInfo.Value.ParamFlags
         );
     } else {
       moduleParameter =
         new ParameterWithoutMetadata(
           this.PEFileToObjectModel,
           paramIndex,
           customModifiers,
           typeReference,
           signatureDefinition,
           isByReference
         );
     }
     moduleParamList.Add(moduleParameter);
     paramIndex++;
   }
   return moduleParamList.ToArray();
 }
Example #28
0
 public bool CtVerify(List <Byte64> cTransactionEntries, ISignature cTSignature)
 {
     throw new System.NotImplementedException();
 }
 public FakeContext(ISignature signature, bool verifyResult)
 {
     _signature    = signature;
     _verifyResult = verifyResult;
 }
Example #30
0
 public bool Verify(ISignature signature, ReadOnlySpan <byte> message, ReadOnlySpan <byte> context)
 {
     return(NativeBinding.StdVerify(signature.SignatureBytes, signature.PublicKeyBytes, message, context));
 }
 protected IParameterTypeInformation[] GetModuleParameterTypeInformations(ISignature signature, int paramCount) {
   var parameterTypes = new IParameterTypeInformation[paramCount];
   for (var index = 0; index < paramCount; index++) {
     bool dummyPinned;
     var customModifiers = this.GetCustomModifiers(out dummyPinned);
     byte currByte = this.SignatureMemoryReader.PeekByte(0);
     if (currByte == ElementType.Sentinel) {
       this.SignatureMemoryReader.SkipBytes(1);
       if (index < paramCount) Array.Resize(ref parameterTypes, index);
       break;
     }
     bool isByReference = false;
     ITypeReference/*?*/ typeReference;
     if (currByte == ElementType.TypedReference) {
       this.SignatureMemoryReader.SkipBytes(1);
       typeReference = this.PEFileToObjectModel.PlatformType.SystemTypedReference;
     } else {
       if (currByte == ElementType.ByReference) {
         this.SignatureMemoryReader.SkipBytes(1);
         isByReference = true;
       }
       typeReference = this.GetTypeReference();
     }
     var parameterType = new ParameterInfo(this.PEFileToObjectModel, index, customModifiers, typeReference, signature, isByReference);
     parameterTypes[index] = parameterType;
   }
   return parameterTypes;
 }
Example #32
0
        /// <summary>
        /// Добавить в сообщение документ с подписью перед отправкой.
        /// </summary>
        /// <param name="message">Сообщение.</param>
        /// <param name="document">Документ.</param>
        /// <param name="signature">Подпись.</param>
        /// <returns>Сообщение.</returns>
        public static Message AddDocumentWithSignature(Message message, Document document, ISignature signature)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }
            if (signature == null)
            {
                throw new ArgumentNullException(nameof(signature));
            }
            if (string.IsNullOrEmpty(document.Id))
            {
                throw new ArgumentException("Не указан идентификатор документа");
            }

            if (message.Documents == null)
            {
                message.Documents = new Document[0];
            }
            if (message.Signs == null)
            {
                message.Signs = new Sign[0];
            }
            if (message.SimpleSignatures == null)
            {
                message.SimpleSignatures = new SimpleSignature[0];
            }

            if (message.Documents.Any(d => d.Id == document.Id))
            {
                throw new ArgumentException("Документ с идентификатором \"{0}\" уже добавлен в сообщение", document.Id);
            }

            AddDocument(message, document);
            AddSignature(message, document, signature);

            return(message);
        }
Example #33
0
        private void ProcessOperations(IMethodBody methodBody)
        {
            List <IOperation> operations = ((methodBody.Operations == null) ? new List <IOperation>(): new List <IOperation>(methodBody.Operations));
            int count = operations.Count;

            ILGenerator generator = new ILGenerator(this.host, methodBody.MethodDefinition);

            if (this.pdbReader != null)
            {
                foreach (var ns in this.pdbReader.GetNamespaceScopes(methodBody))
                {
                    foreach (var uns in ns.UsedNamespaces)
                    {
                        generator.UseNamespace(uns.NamespaceName.Value);
                    }
                }
            }

            this.currentGenerator       = generator;
            this.scopeEnumerator        = this.pdbReader == null ? null : this.pdbReader.GetLocalScopes(methodBody).GetEnumerator();
            this.scopeEnumeratorIsValid = this.scopeEnumerator != null && this.scopeEnumerator.MoveNext();

            var methodName = MemberHelper.GetMemberSignature(methodBody.MethodDefinition, NameFormattingOptions.SmartTypeName);

            #region Record all offsets that appear as part of an exception handler
            Dictionary <uint, bool> offsetsUsedInExceptionInformation = new Dictionary <uint, bool>();
            foreach (var exceptionInfo in methodBody.OperationExceptionInformation ?? Enumerable <IOperationExceptionInformation> .Empty)
            {
                uint x = exceptionInfo.TryStartOffset;
                if (!offsetsUsedInExceptionInformation.ContainsKey(x))
                {
                    offsetsUsedInExceptionInformation.Add(x, true);
                }
                x = exceptionInfo.TryEndOffset;
                if (!offsetsUsedInExceptionInformation.ContainsKey(x))
                {
                    offsetsUsedInExceptionInformation.Add(x, true);
                }
                x = exceptionInfo.HandlerStartOffset;
                if (!offsetsUsedInExceptionInformation.ContainsKey(x))
                {
                    offsetsUsedInExceptionInformation.Add(x, true);
                }
                x = exceptionInfo.HandlerEndOffset;
                if (!offsetsUsedInExceptionInformation.ContainsKey(x))
                {
                    offsetsUsedInExceptionInformation.Add(x, true);
                }
                if (exceptionInfo.HandlerKind == HandlerKind.Filter)
                {
                    x = exceptionInfo.FilterDecisionStartOffset;
                    if (!offsetsUsedInExceptionInformation.ContainsKey(x))
                    {
                        offsetsUsedInExceptionInformation.Add(x, true);
                    }
                }
            }
            #endregion Record all offsets that appear as part of an exception handler

            Dictionary <uint, ILGeneratorLabel> offset2Label = new Dictionary <uint, ILGeneratorLabel>();
            #region Pass 1: Make a label for each branch target
            for (int i = 0; i < count; i++)
            {
                IOperation op = operations[i];
                switch (op.OperationCode)
                {
                case OperationCode.Beq:
                case OperationCode.Bge:
                case OperationCode.Bge_Un:
                case OperationCode.Bgt:
                case OperationCode.Bgt_Un:
                case OperationCode.Ble:
                case OperationCode.Ble_Un:
                case OperationCode.Blt:
                case OperationCode.Blt_Un:
                case OperationCode.Bne_Un:
                case OperationCode.Br:
                case OperationCode.Brfalse:
                case OperationCode.Brtrue:
                case OperationCode.Leave:
                case OperationCode.Beq_S:
                case OperationCode.Bge_S:
                case OperationCode.Bge_Un_S:
                case OperationCode.Bgt_S:
                case OperationCode.Bgt_Un_S:
                case OperationCode.Ble_S:
                case OperationCode.Ble_Un_S:
                case OperationCode.Blt_S:
                case OperationCode.Blt_Un_S:
                case OperationCode.Bne_Un_S:
                case OperationCode.Br_S:
                case OperationCode.Brfalse_S:
                case OperationCode.Brtrue_S:
                case OperationCode.Leave_S:
                    uint x = (uint)op.Value;
                    if (!offset2Label.ContainsKey(x))
                    {
                        offset2Label.Add(x, new ILGeneratorLabel());
                    }
                    break;

                case OperationCode.Switch:
                    uint[] offsets = op.Value as uint[];
                    foreach (var offset in offsets)
                    {
                        if (!offset2Label.ContainsKey(offset))
                        {
                            offset2Label.Add(offset, new ILGeneratorLabel());
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion Pass 1: Make a label for each branch target

            #region Pass 2: Emit each operation, along with labels
            for (int i = 0; i < count; i++)
            {
                IOperation       op = operations[i];
                ILGeneratorLabel label;
                this.EmitDebugInformationFor(op);
                #region Mark operation if it is a label for a branch
                if (offset2Label.TryGetValue(op.Offset, out label))
                {
                    generator.MarkLabel(label);
                }
                #endregion Mark operation if it is a label for a branch

                #region Mark operation if it is pointed to by an exception handler
                bool ignore;
                uint offset = op.Offset;
                if (offsetsUsedInExceptionInformation.TryGetValue(offset, out ignore))
                {
                    foreach (var exceptionInfo in methodBody.OperationExceptionInformation)
                    {
                        if (offset == exceptionInfo.TryStartOffset)
                        {
                            generator.BeginTryBody();
                        }

                        // Never need to do anthing when offset == exceptionInfo.TryEndOffset because
                        // we pick up an EndTryBody from the HandlerEndOffset below
                        //  generator.EndTryBody();

                        if (offset == exceptionInfo.HandlerStartOffset)
                        {
                            switch (exceptionInfo.HandlerKind)
                            {
                            case HandlerKind.Catch:
                                generator.BeginCatchBlock(exceptionInfo.ExceptionType);
                                break;

                            case HandlerKind.Fault:
                                generator.BeginFaultBlock();
                                break;

                            case HandlerKind.Filter:
                                generator.BeginFilterBody();
                                break;

                            case HandlerKind.Finally:
                                generator.BeginFinallyBlock();
                                break;
                            }
                        }
                        if (exceptionInfo.HandlerKind == HandlerKind.Filter && offset == exceptionInfo.FilterDecisionStartOffset)
                        {
                            generator.BeginFilterBlock();
                        }
                        if (offset == exceptionInfo.HandlerEndOffset)
                        {
                            generator.EndTryBody();
                        }
                    }
                }
                #endregion Mark operation if it is pointed to by an exception handler

                #region Emit operation along with any injection
                switch (op.OperationCode)
                {
                    #region Branches
                case OperationCode.Beq:
                case OperationCode.Bge:
                case OperationCode.Bge_Un:
                case OperationCode.Bgt:
                case OperationCode.Bgt_Un:
                case OperationCode.Ble:
                case OperationCode.Ble_Un:
                case OperationCode.Blt:
                case OperationCode.Blt_Un:
                case OperationCode.Bne_Un:
                case OperationCode.Br:
                case OperationCode.Brfalse:
                case OperationCode.Brtrue:
                case OperationCode.Leave:
                case OperationCode.Beq_S:
                case OperationCode.Bge_S:
                case OperationCode.Bge_Un_S:
                case OperationCode.Bgt_S:
                case OperationCode.Bgt_Un_S:
                case OperationCode.Ble_S:
                case OperationCode.Ble_Un_S:
                case OperationCode.Blt_S:
                case OperationCode.Blt_Un_S:
                case OperationCode.Bne_Un_S:
                case OperationCode.Br_S:
                case OperationCode.Brfalse_S:
                case OperationCode.Brtrue_S:
                case OperationCode.Leave_S:
                    generator.Emit(ILGenerator.LongVersionOf(op.OperationCode), offset2Label[(uint)op.Value]);
                    break;

                case OperationCode.Switch:
                    uint[]             offsets = op.Value as uint[];
                    ILGeneratorLabel[] labels  = new ILGeneratorLabel[offsets.Length];
                    for (int j = 0, n = offsets.Length; j < n; j++)
                    {
                        labels[j] = offset2Label[offsets[j]];
                    }
                    generator.Emit(OperationCode.Switch, labels);
                    break;

                    #endregion Branches
                    #region Everything else
                case OperationCode.Stloc_0:
                case OperationCode.Stloc_1:
                case OperationCode.Stloc_2:
                case OperationCode.Stloc_3:
                    generator.Emit(op.OperationCode);
                    EmitStoreLocal(generator, op);
                    break;

                case OperationCode.Stloc:
                case OperationCode.Stloc_S:
                    generator.Emit(op.OperationCode, op.Value);
                    EmitStoreLocal(generator, op);
                    break;

                default:
                    if (op.Value == null)
                    {
                        generator.Emit(op.OperationCode);
                        break;
                    }
                    var typeCode = System.Convert.GetTypeCode(op.Value);
                    switch (typeCode)
                    {
                    case TypeCode.Byte:
                        generator.Emit(op.OperationCode, (byte)op.Value);
                        break;

                    case TypeCode.Double:
                        generator.Emit(op.OperationCode, (double)op.Value);
                        break;

                    case TypeCode.Int16:
                        generator.Emit(op.OperationCode, (short)op.Value);
                        break;

                    case TypeCode.Int32:
                        generator.Emit(op.OperationCode, (int)op.Value);
                        break;

                    case TypeCode.Int64:
                        generator.Emit(op.OperationCode, (long)op.Value);
                        break;

                    case TypeCode.Object:
                        IFieldReference fieldReference = op.Value as IFieldReference;
                        if (fieldReference != null)
                        {
                            generator.Emit(op.OperationCode, this.Rewrite(fieldReference));
                            break;
                        }
                        ILocalDefinition localDefinition = op.Value as ILocalDefinition;
                        if (localDefinition != null)
                        {
                            generator.Emit(op.OperationCode, localDefinition);
                            break;
                        }
                        IMethodReference methodReference = op.Value as IMethodReference;
                        if (methodReference != null)
                        {
                            generator.Emit(op.OperationCode, this.Rewrite(methodReference));
                            break;
                        }
                        IParameterDefinition parameterDefinition = op.Value as IParameterDefinition;
                        if (parameterDefinition != null)
                        {
                            generator.Emit(op.OperationCode, parameterDefinition);
                            break;
                        }
                        ISignature signature = op.Value as ISignature;
                        if (signature != null)
                        {
                            generator.Emit(op.OperationCode, signature);
                            break;
                        }
                        ITypeReference typeReference = op.Value as ITypeReference;
                        if (typeReference != null)
                        {
                            generator.Emit(op.OperationCode, this.Rewrite(typeReference));
                            break;
                        }
                        throw new ILMutatorException("Should never get here: no other IOperation argument types should exist");

                    case TypeCode.SByte:
                        generator.Emit(op.OperationCode, (sbyte)op.Value);
                        break;

                    case TypeCode.Single:
                        generator.Emit(op.OperationCode, (float)op.Value);
                        break;

                    case TypeCode.String:
                        generator.Emit(op.OperationCode, (string)op.Value);
                        break;

                    default:
                        // The other cases are the other enum values that TypeCode has.
                        // But no other argument types should be in the Operations. ILGenerator cannot handle anything else,
                        // so such IOperations should never exist.
                        //case TypeCode.Boolean:
                        //case TypeCode.Char:
                        //case TypeCode.DateTime:
                        //case TypeCode.DBNull:
                        //case TypeCode.Decimal:
                        //case TypeCode.Empty: // this would be the value for null, but the case when op.Value is null is handled before the switch statement
                        //case TypeCode.UInt16:
                        //case TypeCode.UInt32:
                        //case TypeCode.UInt64:
                        throw new ILMutatorException("Should never get here: no other IOperation argument types should exist");
                    }
                    break;
                    #endregion Everything else
                }
                #endregion Emit operation along with any injection
            }
            while (generator.InTryBody)
            {
                generator.EndTryBody();
            }
            while (this.scopeStack.Count > 0)
            {
                this.currentGenerator.EndScope();
                this.scopeStack.Pop();
            }
            #endregion Pass 2: Emit each operation, along with labels
        }
Example #34
0
 public SignatureParameter(string documentation, Span locus, Span prettyPrintedLocus, string name, ISignature signature)
 {
     Documentation      = documentation;
     Locus              = locus;
     PrettyPrintedLocus = prettyPrintedLocus;
     Name      = name;
     Signature = signature;
 }
Example #35
0
 /// <summary>
 /// Puts the specified instruction and a token for the given signature onto the Microsoft intermediate language (MSIL) stream of instructions.
 /// </summary>
 /// <param name="opcode">The Microsoft intermediate language (MSIL) instruction to be put onto the stream.</param>
 /// <param name="signature">The signature of the method or function pointer to call. Can include information about extra arguments.</param>
 public void Emit(OperationCode opcode, ISignature signature)
 {
     this.operations.Add(new Operation(opcode, this.offset, this.GetCurrentSequencePoint(), signature));
     this.offset += SizeOfOperationCode(opcode) + 4;
 }
        private void UpdateSignatureInfo()
        {
            // If the session is in a bad state, just don't update.
            Debug.Assert(_session != null, "How'd we get a null session?");
            if ((_session == null) || _session.IsDismissed || (_session.Signatures.Count < 1))
            {
                return;
            }

            // Determine which signature we should be rendering.  This is usually the selected signature, but if we run up against
            // a session with no selected signature, just use the first one.
            ISignature sigToRender = _session.SelectedSignature != null ? _session.SelectedSignature : _session.Signatures[0];

            // Make sure the content type of the signature text buffer is correct.
            IContentType desiredContentType = this.GetSignatureHelpContentType(sigToRender);

            if (_signatureTextBuffer.ContentType != desiredContentType)
            {
                _signatureTextBuffer.ChangeContentType(desiredContentType, null);
            }

            // Update the text in the signature text buffer to match the new signature being displayed.
            this.DisplayContent(sigToRender);

            // If all the content didn't fit in one line, then try the pretty printed content unless it's null (see Dev11 #376399)
            if (_signatureWpfTextView.RealWidth > this.ContainerMaxWidth - this.PagerWidth - 4 &&
                sigToRender.PrettyPrintedContent != null)
            {
                this.DisplayPrettyPrintedContent(sigToRender);

                // Ensure that the pretty printed content fits, otherwise, switch back to the regular content as a last resort
                if (_signatureWpfTextView.RealWidth > this.ContainerMaxWidth - this.PagerWidth - 4)
                {
                    this.DisplayContent(sigToRender);
                }
            }

            // Update the documentation of the signature to match.
            if (!string.IsNullOrEmpty(sigToRender.Documentation))
            {
                this.SignatureDocumentation           = sigToRender.Documentation;
                this.SignatureDocumentationVisibility = true;
            }
            else
            {
                this.SignatureDocumentationVisibility = false;
                this.SignatureDocumentation           = string.Empty;
            }

            // See if the pager should be enabled.  It should show up only if there are at least 2 signatures.
            if (this.Session.Signatures.Count > 1)
            {
                // The pager should be enabled.
                int selectionIndex = this.Session.Signatures.IndexOf(sigToRender);
                this.PagerText = GettextCatalog.GetString("{0} of {1}",
                                                          selectionIndex + 1,
                                                          this.Session.Signatures.Count);
                this.PagerVisibility = true;
            }
            else
            {
                // The pager should not be enabled.
                this.PagerVisibility = false;
                this.PagerText       = string.Empty;
            }

            // Whenever the signature information is being updated, chances are we have to update the parameter info as well.
            this.UpdateParameterInfo();
        }
Example #37
0
 public static bool SignaturesParametersAreEqual(this ISignature sig1, ISignature sig2)
 {
     return IteratorHelper.EnumerablesAreEqual<IParameterTypeInformation>(sig1.Parameters, sig2.Parameters, new ParameterInformationComparer());
 }
Example #38
0
 public GLSLParameter(ISignature signature, ParameterDefinition parameter, Span locus)
 {
     this.Signature = signature;
     this.Name      = parameter.Name.Text;
     this.Locus     = locus;
 }
Example #39
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="session">Signature help session</param>
 /// <param name="signature">Signature to classify</param>
 public SignatureDocumentationSignatureHelpClassifierContext(ISignatureHelpSession session, ISignature signature)
     : base(SignatureHelpClassifierContextTypes.SignatureDocumentation, session) => Signature = signature ?? throw new ArgumentNullException(nameof(signature));
Example #40
0
 public SelectedSignatureChangedEventArgs(ISignature previousSelectedSignature, ISignature newSelectedSignature)
 {
     PreviousSelectedSignature = previousSelectedSignature;
     NewSelectedSignature      = newSelectedSignature;
 }
 public bool Verify(ISignature signature, ReadOnlySpan <byte> message, ReadOnlySpan <byte> context)
 {
     return(_verifyResult);
 }
Example #42
0
 void ISymbolDisplayBuilder.BuildSignatureDisplay(ISignature signatures, ISymbolWriter writer, INode enclosingDeclaration, TypeFormatFlags flags, SignatureKind kind)
 {
     BuildSignatureDisplay(signatures, writer, enclosingDeclaration, flags, kind, symbolStack: null);
 }
Example #43
0
 public ParameterWithNewSignature(IParameter original, ISignature newSignature) {
   Documentation = original.Documentation;
   Locus = original.Locus;
   Name = original.Name;
   Signature = newSignature;
   PrettyPrintedLocus = original.PrettyPrintedLocus;
 }
Example #44
0
 void ISymbolDisplayBuilder.BuildReturnTypeDisplay(ISignature signature, ISymbolWriter writer, INode enclosingDeclaration, TypeFormatFlags flags)
 {
     BuildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack: null);
 }
Example #45
0
 /// <summary>
 /// Puts the specified instruction and a token for the given signature onto the Microsoft intermediate language (MSIL) stream of instructions.
 /// </summary>
 /// <param name="opcode">The Microsoft intermediate language (MSIL) instruction to be put onto the stream.</param>
 /// <param name="signature">The signature of the method or function pointer to call. Can include information about extra arguments.</param>
 public void Emit(OperationCode opcode, ISignature signature)
 {
     this.operations.Add(new Operation(opcode, this.offset, this.GetCurrentSequencePoint(), signature));
       this.offset += SizeOfOperationCode(opcode)+4;
 }
Example #46
0
        /// <inheritdoc/>
        public bool Verify(ISignature signature, ReadOnlySpan <byte> data, SigningContext signingContext)
        {
            using var pooled = signingContext.SerializeToPooledBytes();

            return(_cryptoContext.Verify(signature, data, pooled.Span));
        }
Example #47
0
 protected IModuleParameterTypeInformation[] GetModuleParameterTypeInformations(ISignature signatureDefinition, int paramCount) {
   int paramIndex = 0;
   List<IModuleParameterTypeInformation> moduleParamTypeInfoList = new List<IModuleParameterTypeInformation>();
   while (paramIndex < paramCount) {
     bool dummyPinned;
     EnumerableArrayWrapper<CustomModifier, ICustomModifier> customModifiers = this.GetCustomModifiers(out dummyPinned);
     byte currByte = this.SignatureMemoryReader.PeekByte(0);
     if (currByte == ElementType.Sentinel) {
       this.SignatureMemoryReader.SkipBytes(1);
       break;
     }
     bool isByReference = false;
     IModuleTypeReference/*?*/ typeReference;
     if (currByte == ElementType.TypedReference) {
       this.SignatureMemoryReader.SkipBytes(1);
       typeReference = this.PEFileToObjectModel.SystemTypedReference;
     } else {
       if (currByte == ElementType.ByReference) {
         this.SignatureMemoryReader.SkipBytes(1);
         isByReference = true;
       }
       typeReference = this.GetTypeReference();
     }
     IModuleParameterTypeInformation moduleParameter =
       new ParameterInfo(
         this.PEFileToObjectModel,
         paramIndex,
         customModifiers,
         typeReference,
         signatureDefinition,
         isByReference
       );
     moduleParamTypeInfoList.Add(moduleParameter);
     paramIndex++;
   }
   return moduleParamTypeInfoList.ToArray();
 }
 protected override bool ValidateChain(ISignature signer, X509Chain chain, SignatureLogger verboseWriter)
 {
     return(ValidateStrongChain(signer, chain, verboseWriter));
 }
Example #49
0
    private void Visit(ISignature signature) {
      Contract.Requires(signature != null);

      signature.Type.ResolvedType.Dispatch(this);
      if (signature.ReturnValueIsModified) this.Visit(signature.ReturnValueCustomModifiers);
      foreach (var par in signature.Parameters) {
        Contract.Assume(par != null);
        this.Visit(par);
      }
      int h = this.hash;
      h = (h << 5 + h) ^ (int)signature.CallingConvention;
      if (signature.ReturnValueIsByRef) h = (h << 5 + h) ^ 2;
      this.hash = h;
    }
Example #50
0
 private AfterAction(ISignature signature, Action <T> handler)
 {
     Handler   = handler;
     Signature = signature;
 }
Example #51
0
        // Append return type only on op_Explicit methods
        protected override void AppendReturnTypeSignature(ISignature sig, NameFormattingOptions formattingOptions, StringBuilder sb)
        {
            if ((formattingOptions & NameFormattingOptions.ReturnType) == 0) return;
            ITypeMemberReference member = sig as ITypeMemberReference;
            // TODO: Review
            //if (sig.CallingConvention != CallingConvention.Default)
            //{
            //    sb.Append(' ');
            //    sb.Append(sig.CallingConvention);
            //}
            if (sig.ReturnValueIsModified)
            {
                foreach (ICustomModifier modifier in sig.ReturnValueCustomModifiers)
                {
                    AppendCustomModifier(formattingOptions, sb, modifier);
                }
            }
            //===========

            if (member == null || (member.Name.Value != "op_Explicit" && member.Name.Value != "op_Implicit")) return;

            sb.Append(" : ");
            sb.Append(_formatter.GetTypeName(sig.Type, formattingOptions & ~NameFormattingOptions.OmitContainingType));
        }
Example #52
0
 /// <summary>
 /// Creates a new observable property access proxy
 /// </summary>
 /// <param name="modelElement">The model instance element for which to create the property access proxy</param>
 public ReturnTypeProxy(ISignature modelElement) :
     base(modelElement, "ReturnType")
 {
 }
 protected IParameterDefinition[] GetModuleParameters(bool useParamInfo, ISignature signatureDefinition, int paramCount) {
   MethodDefinition/*?*/ moduleMethod = signatureDefinition as MethodDefinition;
   int paramIndex = 0;
   var parameters = new IParameterDefinition[paramCount];
   while (paramIndex < paramCount) {
     bool dummyPinned;
     var customModifiers = this.GetCustomModifiers(out dummyPinned);
     byte currByte = this.SignatureMemoryReader.PeekByte(0);
     if (currByte == ElementType.Sentinel) {
       this.SignatureMemoryReader.SkipBytes(1);
       var requiredParameters = new IParameterDefinition[paramIndex];
       for (int i = 0; i < paramIndex; i++) requiredParameters[i] = parameters[i];
       return requiredParameters;
     }
     bool isByReference = false;
     ITypeReference/*?*/ typeReference;
     if (currByte == ElementType.TypedReference) {
       this.SignatureMemoryReader.SkipBytes(1);
       typeReference = this.PEFileToObjectModel.PlatformType.SystemTypedReference;
     } else {
       if (currByte == ElementType.ByReference) {
         this.SignatureMemoryReader.SkipBytes(1);
         isByReference = true;
       }
       typeReference = this.GetTypeReference();
     }
     ParamInfo? paramInfo = useParamInfo ? this.GetParamInfo(paramIndex + 1) : null;
     IParameterDefinition moduleParameter;
     if (paramInfo.HasValue) {
       var paramArrayType = typeReference as IArrayTypeReference;
       moduleParameter = new ParameterWithMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, moduleMethod, isByReference,
         (paramIndex == paramCount - 1) && paramArrayType != null && paramArrayType.IsVector, paramInfo.Value.ParamRowId, paramInfo.Value.ParamName, paramInfo.Value.ParamFlags);
     } else
       moduleParameter = new ParameterWithoutMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, signatureDefinition, isByReference);
     parameters[paramIndex++] = moduleParameter;
   }
   return parameters;
 }
Example #54
0
        public ITypeReference FunctionPointerType(ISignature signature)
        {
            var type = new FunctionPointerType(signature, host.InternFactory);

            return(type);
        }
Example #55
0
 public static AfterAction <T> CreateNew(ISignature signature, MethodInfo method, object instance)
 {
     return(new AfterAction <T>(signature, method.CreateAfterEventDelegate <T>(instance)));
 }
Example #56
0
        private static void InitializeArgumentsAndPushReturnResult(Instruction instruction, Stack <Instruction> stack, ISignature signature)
        {
            Contract.Requires(instruction != null);
            Contract.Requires(stack != null);
            Contract.Requires(signature != null);

            var  methodRef    = signature as IMethodReference;
            uint numArguments = IteratorHelper.EnumerableCount(signature.Parameters);

            if (methodRef != null && methodRef.AcceptsExtraArguments)
            {
                numArguments += IteratorHelper.EnumerableCount(methodRef.ExtraParameters);
            }
            if (!signature.IsStatic)
            {
                numArguments++;
            }
            if (numArguments > 0)
            {
                numArguments--;
                if (numArguments > 0)
                {
                    var arguments = new Instruction[numArguments];
                    instruction.Operand2 = arguments;
                    for (var i = numArguments; i > 0; i--)
                    {
                        arguments[i - 1] = stack.Pop();
                    }
                }
                instruction.Operand1 = stack.Pop();
            }
            if (signature.Type.TypeCode != PrimitiveTypeCode.Void)
            {
                stack.Push(instruction);
            }
        }
Example #57
0
 public JParameter(ISignature signature, ParameterResult param, Span locus)
 {
     _signature = signature;
     _param = param;
     _locus = locus;
 }
        private static void InitializeArgumentsAndPushReturnResult(Instruction instruction, Stack <Instruction> stack, ISignature signature)
        {
            Contract.Requires(instruction != null);
            Contract.Requires(stack != null);
            Contract.Requires(signature != null);

            var numArguments = IteratorHelper.EnumerableCount(signature.Parameters);
            var arguments    = new Instruction[numArguments];

            instruction.Operand2 = arguments;
            for (var i = numArguments; i > 0; i--)
            {
                arguments[i - 1] = stack.Pop();
            }
            if (!signature.IsStatic)
            {
                instruction.Operand1 = stack.Pop();
            }
            if (signature.Type.TypeCode != PrimitiveTypeCode.Void)
            {
                stack.Push(instruction);
            }
        }
Example #59
0
 private static ISignature[] GetLiveSignatures(string text, ICollection<OverloadDoc> liveSigs, int paramIndex, ITrackingSpan span, string lastKeywordArg) {
     ISignature[] res = new ISignature[liveSigs.Count];
     int i = 0;
     foreach (var sig in liveSigs) {
         res[i++] = new PythonSignature(
             span,
             new LiveOverloadResult(text, sig.Documentation, sig.Parameters),
             paramIndex,
             lastKeywordArg
         );
     }
     return res;
 }
Example #60
0
 public static bool SignaturesParametersAreEqual(this ISignature sig1, ISignature sig2)
 {
     return(IteratorHelper.EnumerablesAreEqual <IParameterTypeInformation>(sig1.Parameters, sig2.Parameters, new ParameterInformationComparer()));
 }