public static AbstractType Demangle(string mangledString, ResolutionContext ctxt, out ITypeDeclaration qualifier, out bool isCFunction) { if(string.IsNullOrEmpty(mangledString)) throw new ArgumentException("input string must not be null or empty!"); if (!mangledString.StartsWith("_D")) { isCFunction = true; if (mangledString.StartsWith ("__D")) mangledString = mangledString.Substring (1); // C Functions else if (mangledString.StartsWith ("_")) { qualifier = new IdentifierDeclaration (mangledString.Substring (1)); return null; } } //TODO: What about C functions that start with 'D'? isCFunction = false; var dmng = new Demangler(mangledString) { ctxt = ctxt }; return dmng.MangledName(out qualifier); }
private IModule GetModule(ITypeReference typeReference) { if (typeReference != null) { if (typeReference.GenericType != null) { typeReference = typeReference.GenericType; } ITypeDeclaration typeDeclaration = typeReference.Resolve(); if (typeDeclaration != null) { do { IModule module = typeDeclaration.Owner as IModule; if (module != null) { return(module); } typeDeclaration = typeDeclaration.Owner as ITypeDeclaration; }while (typeDeclaration != null); } } return(null); }
protected internal EqualFormulaRef(IFormulaRef left, IFormulaRef right, ITypeDeclaration type, IMethodDeclaration method, IFormulaRef parent) : base(left, right, type, method, parent) { this.parent = parent; this.left = left; this.right = right; }
public override ITypeDeclaration Transform(ITypeDeclaration itd) { analysis = new MethodAnalysisTransform(); Stopwatch watch = null; if (compiler.ShowProgress) { Console.Write($"({analysis.Name} "); watch = Stopwatch.StartNew(); } analysis.Context.InputAttributes = context.InputAttributes; analysis.Transform(itd); if (compiler.ShowProgress) { watch.Stop(); Console.Write("{0}ms) ", watch.ElapsedMilliseconds); } context.Results = analysis.Context.Results; if (!context.Results.IsSuccess) { Error("analysis failed"); return(itd); } if (debug) { Trace.WriteLine("method graph:"); Trace.WriteLine(analysis.MethodGraph); } Initialise(); CheckAcyclic(analysis.MethodGraph); // collect the set of public methods foreach (var methodIndex in analysis.MethodGraph.Nodes) { if (analysis.methods[methodIndex].Declaration.Visibility.HasFlag(MethodVisibility.Public)) { publicMethods.Add(methodIndex); } } detailsOfMethod = Util.ArrayInit(analysis.MethodGraph.Nodes.Count, methodIndex => new MethodDetails()); // runs faster with CallersBeforeCallees var methodOrder = GetCallersBeforeCallees(analysis.MethodGraph); methodsToAnalyze.AddRange(methodOrder); while (methodsToAnalyze.Count > 0) { foreach (int methodIndex in methodOrder) { if (methodsToAnalyze.Contains(methodIndex)) { // AnalyzeMethod may add new methods to methodsToAnalyze. AnalyzeMethod(methodIndex); } } } if (debug) { Trace.WriteLine($"{this.Name}: {analysis.MethodGraph.Nodes.Count} methods, {methodsAnalyzedCount} methods analyzed"); } return(itd); }
public static IExpression TryConvertTypeDeclaration(ITypeDeclaration td, bool ignoreInnerDeclaration = false) { if (td.InnerDeclaration == null || ignoreInnerDeclaration) { if (td is IdentifierDeclaration) { var id = td as IdentifierDeclaration; if (id.Id == null) return null; return new IdentifierExpression(id.Id) { Location = id.Location, EndLocation = id.EndLocation }; } if (td is TemplateInstanceExpression) return td as IExpression; return null; } var pfa = new PostfixExpression_Access{ PostfixForeExpression = TryConvertTypeDeclaration(td.InnerDeclaration), AccessExpression = TryConvertTypeDeclaration(td, true) }; if (pfa.PostfixForeExpression == null) return null; return pfa; }
public override ITypeDeclaration Transform(ITypeDeclaration itd) { analysis = new LivenessAnalysisTransform(compiler); Stopwatch watch = null; if (compiler.ShowProgress) { Console.Write($"({analysis.Name} "); watch = Stopwatch.StartNew(); } analysis.Context.InputAttributes = context.InputAttributes; analysis.Transform(itd); if (compiler.ShowProgress) { watch.Stop(); Console.Write("{0}ms) ", watch.ElapsedMilliseconds); } context.Results = analysis.Context.Results; if (!context.Results.IsSuccess) { Error("analysis failed"); return(itd); } var itdOut = base.Transform(itd); return(itdOut); }
public static string Mangle(ITypeDeclaration td) { var sb = new StringBuilder(); Mangle(td, sb); return(sb.ToString()); }
internal TaskGraphView(ITypeDeclaration itd, BasicTransformContext context) { pretasks = Builder.StmtCollection(); looptasks = Builder.StmtCollection(); foreach (IMethodDeclaration imd in itd.Methods) { if (!context.InputAttributes.Has <OperatorMethod>(imd)) { continue; } foreach (IStatement ist in imd.Body.Statements) { if (ist is IWhileStatement) { looptasks.AddRange(((IWhileStatement)ist).Body.Statements); continue; } if (context.InputAttributes.Has <OperatorStatement>(ist)) { pretasks.Add(ist); } } // if (imd.Name == "Initialise") pretasks.AddRange(((IBlockStatement)imd.Body).Statements); //if (imd.Name == "Update") looptasks.AddRange(((IBlockStatement)imd.Body).Statements); } this.context = context; OnTasksChanged(); }
private static ICollection GetInterfaces(ITypeDeclaration value) { ArrayList list = new ArrayList(value.Interfaces); if (value.BaseType != null) { ITypeDeclaration baseType = value.BaseType.Resolve(); foreach (ITypeReference interfaceReference in baseType.Interfaces) { if (list.Contains(interfaceReference)) { list.Remove(interfaceReference); } } } foreach (ITypeReference interfaceReference in value.Interfaces) { ITypeDeclaration interfaceDeclaration = interfaceReference.Resolve(); foreach (ITypeReference interfaceBaseReference in interfaceDeclaration.Interfaces) { if (list.Contains(interfaceBaseReference)) { list.Remove(interfaceBaseReference); } } } ITypeReference[] array = new ITypeReference[list.Count]; list.CopyTo(array, 0); return(array); }
public override ITypeDeclaration Transform(ITypeDeclaration itd) { analysis = new ChannelAnalysisTransform(); analysis.Context.InputAttributes = context.InputAttributes; analysis.Transform(itd); context.Results = analysis.Context.Results; var itdOut = base.Transform(itd); if (context.trackTransform && debug) { IBlockStatement block = Builder.BlockStmt(); foreach (var entry in analysis.usageInfo) { IVariableDeclaration ivd = entry.Key; var info = entry.Value; block.Statements.Add(Builder.CommentStmt(info.ToString())); } context.OutputAttributes.Add(itdOut, new DebugInfo() { Transform = this, Name = "analysis", Value = block }); } return(itdOut); }
public List <ITypeDeclaration> TransformToDeclaration(ITypeDeclaration typeDecl) { Stack <ITypeDeclaration> typesToTransform = new Stack <ITypeDeclaration>(); typesToTransform.Push(typeDecl); HashSet <ITypeDeclaration> typesTransformed = new HashSet <ITypeDeclaration>(); List <ITypeDeclaration> typeDeclarations = new List <ITypeDeclaration>(); while (typesToTransform.Count > 0) { ITypeDeclaration itd = typesToTransform.Pop(); ITypeDeclaration td = Transform.Transform(itd); transformMap[itd] = td; typeDeclarations.Add(td); typesTransformed.Add(itd); foreach (ITypeDeclaration t2 in Transform.Context.TypesToTransform) { if (!typesTransformed.Contains(t2)) { typesToTransform.Push(t2); } } } return(typeDeclarations); }
public bool HandleDecl(TemplateTypeParameter p ,ITypeDeclaration td, ISemantic rr) { if (td is IdentifierDeclaration) return HandleDecl(p,(IdentifierDeclaration)td, rr); //HACK Ensure that no information gets lost by using this function // -- getting a value but requiring an abstract type and just extract it from the value - is this correct behaviour? var at = AbstractType.Get(rr); if (td is ArrayDecl) return HandleDecl(p,(ArrayDecl)td, DResolver.StripMemberSymbols(at) as AssocArrayType); else if (td is DTokenDeclaration) return HandleDecl((DTokenDeclaration)td, at); else if (td is DelegateDeclaration) return HandleDecl(p, (DelegateDeclaration)td, DResolver.StripMemberSymbols(at) as DelegateType); else if (td is PointerDecl) return HandleDecl(p, (PointerDecl)td, DResolver.StripMemberSymbols(at) as PointerType); else if (td is MemberFunctionAttributeDecl) return HandleDecl(p,(MemberFunctionAttributeDecl)td, at); else if (td is TypeOfDeclaration) return HandleDecl((TypeOfDeclaration)td, at); else if (td is VectorDeclaration) return HandleDecl((VectorDeclaration)td, at); else if (td is TemplateInstanceExpression) return HandleDecl(p,(TemplateInstanceExpression)td, at); return false; }
/// <summary> /// Constructor. /// </summary> /// <param name="typeDeclaration">TypeDeclaration to decompile into a BizTalk artifact.</param> public DecompiledArtifact(ITypeDeclaration typeDeclaration) { Namespace = typeDeclaration.Namespace; Name = typeDeclaration.Name; ArtifactValue = ExtractArtifact(typeDeclaration); }
/// <summary> /// Extract the initializer for the given TypeDeclaration. /// </summary> /// <param name="typeDeclaration">TypeDeclaration to extarct the initializer from.</param> /// <returns>Value of the initializer as a string.</returns> protected virtual string ExtractArtifact(ITypeDeclaration typeDeclaration) { string value = null; // Locate the field for this artifact and extract its initializer string expectedFieldName = FieldName; foreach (IFieldDeclaration fieldDeclaration in typeDeclaration.Fields) { // BizTalk 2006 compiles textual representations as private const string fields if (fieldDeclaration.Visibility == FieldVisibility.Private) { // Loacte the field holding the textual representation of the artifact if (String.CompareOrdinal(expectedFieldName, fieldDeclaration.Name) == 0) { ILiteralExpression litteralExpression = fieldDeclaration.Initializer as ILiteralExpression; if (litteralExpression != null) { value = litteralExpression.Value as string; break; } } } } return(value); }
/// <summary> /// Fetches every Type Declaration in the assembly /// </summary> public static void FetchTypes() { // Search the current and (if the NodeEditor is packed into a .dll) the calling one types = new Dictionary <string, TypeData> (); List <Assembly> scriptAssemblies = AppDomain.CurrentDomain.GetAssemblies() .Where((Assembly a) => a.FullName.StartsWith("Assembly-")) .ToList(); // This filters out all script assemblies if (!scriptAssemblies.Contains(Assembly.GetExecutingAssembly())) { scriptAssemblies.Add(Assembly.GetExecutingAssembly()); } foreach (Assembly assembly in scriptAssemblies) { foreach (Type type in assembly.GetTypes().Where(T => T.IsClass && !T.IsAbstract && T.GetInterfaces().Contains(typeof(ITypeDeclaration)))) { ITypeDeclaration typeDecl = assembly.CreateInstance(type.FullName) as ITypeDeclaration; if (typeDecl == null) { UnityEngine.Debug.LogError("Error with Type Declaration " + type.FullName); return; } Texture2D InputKnob = NodeEditor.LoadTexture(typeDecl.InputKnob_TexPath); Texture2D OutputKnob = NodeEditor.LoadTexture(typeDecl.OutputKnob_TexPath); types.Add(typeDecl.name, new TypeData(typeDecl.col, InputKnob, OutputKnob, typeDecl.Type)); } } }
protected internal ConditionalFormula(IFormula test, IFormula ifTrue, IFormula ifFalse, ITypeDeclaration type, IFormula parent) : base(NodeType.Conditional, type, parent) { Test = test; IfTrue = ifTrue; IfFalse = ifFalse; }
public string BuildArrayContentString(ulong Offset, ITypeDeclaration type) { bool IsString; object[] marr = ExtractArray(Offset, type, out IsString); return(BuildArrayContentString(marr, IsString)); }
/// <summary> /// Fetches every Type Declaration in the assembly /// </summary> public static void FetchTypes() { // Search the current and (if the NodeEditor is packed into a .dll) the calling one types = new Dictionary <string, TypeData> (); List <Assembly> scriptAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList(); if (!scriptAssemblies.Contains(Assembly.GetExecutingAssembly())) { scriptAssemblies.Add(Assembly.GetExecutingAssembly()); } foreach (Assembly assembly in scriptAssemblies) { if (!assembly.FullName.Contains("Assembly")) { continue; } foreach (Type type in assembly.GetTypes().Where(T => T.IsClass && !T.IsAbstract && T.GetInterfaces().Contains(typeof(ITypeDeclaration)))) { ITypeDeclaration typeDecl = assembly.CreateInstance(type.FullName) as ITypeDeclaration; if (typeDecl == null) { Debug.LogError("Error with Type Declaration " + type.FullName); return; } types.Add(typeDecl.name, new TypeData(typeDecl)); } } }
bool IsMoreSpecialized(ITypeDeclaration Spec, TemplateParameter t2, Dictionary <TemplateParameter, ISemantic> t1_DummyParamList) { AbstractType t1_TypeResults; // Make a type out of t1's specialization using (ctxt.Push(ctxt.ScopedBlock != null ? ctxt.ScopedBlock.Parent : null)) { var dict = ctxt.CurrentContext.DeducedTemplateParameters; // Make the T in e.g. T[] a virtual type so T will be replaced by it // T** will be X** then - so a theoretically valid type instead of a template param var dummyType = new ClassType(new DClassLike { Name = "X" }, null, null); foreach (var kv in t1_DummyParamList) { dict[kv.Key] = new TemplateParameterSymbol(t2, dummyType); } t1_TypeResults = Resolver.TypeResolution.TypeDeclarationResolver.ResolveSingle(Spec, ctxt); } if (t1_TypeResults == null) { return(true); } // Now try to fit the virtual Type t2 into t1 - and return true if it's possible return(new TemplateParameterDeduction(new DeducedTypeDictionary(), ctxt).Handle(t2, t1_TypeResults)); }
public static DMethod ParseMethodDeclarationHeader(string headerCode, out ITypeDeclaration identifierChain) { using (var sr = new StringReader(headerCode)) { var p = Create(sr); p.Step(); var n = new DMethod(); p.CheckForStorageClasses(p.doc); p.ApplyAttributes(n); p.FunctionAttributes(n); n.Type = p.Type(null); identifierChain = p.IdentifierList(); if (identifierChain is IdentifierDeclaration) { n.NameHash = (identifierChain as IdentifierDeclaration).IdHash; } n.Parameters = p.Parameters(n); return(n); } }
public ParameterDeclaration AddParam(ITypeDeclaration type, string name, bool nonNull) { ParameterDeclaration p = new ParameterDeclaration(type, name, nonNull); this.Parameters.Add(p); return(p); }
public virtual void VisitInner(ITypeDeclaration td) { if (td.InnerDeclaration != null) { td.InnerDeclaration.Accept(this); } }
public void MarkTypeAsUsed(ITypeDeclaration declaration) { SetConstructorsState(declaration.DeclaredElement, UsageState.USED_MASK | UsageState.CANNOT_BE_PRIVATE | UsageState.CANNOT_BE_INTERNAL | UsageState.CANNOT_BE_PROTECTED); collectUsagesStageProcess.SetElementState(declaration.DeclaredElement, UsageState.ACCESSED); }
public static AbstractType DemangleAndResolve(string mangledString, ResolutionContext ctxt, out ITypeDeclaration qualifier) { bool isCFunction; Demangler.Demangle(mangledString, ctxt, out qualifier, out isCFunction); // Seek for C functions | Functions that have no direct module association (e.g. _Dmain) if(qualifier is IdentifierDeclaration && qualifier.InnerDeclaration == null) { var id = (qualifier as IdentifierDeclaration).Id; return Resolver.ASTScanner.NameScan.ScanForCFunction(ctxt, id, isCFunction); } bool seekCtor = false; if(qualifier is IdentifierDeclaration) { var id = (qualifier as IdentifierDeclaration).Id; if((seekCtor = (id == DMethod.ConstructorIdentifier)) || id == "__Class" || id =="__ModuleInfo") qualifier = qualifier.InnerDeclaration; } var resSym = TypeDeclarationResolver.ResolveSingle(qualifier,ctxt); if(seekCtor && resSym is UserDefinedType) { var ctor = (resSym as TemplateIntermediateType).Definition[DMethod.ConstructorIdentifier].FirstOrDefault(); if(ctor!= null) resSym = new MemberSymbol(ctor as DNode, null, null); } return resSym; }
private void AddCollectionMethods(ClassDeclaration col, ITypeDeclaration mappedType, string name, string pname) { // add method MethodDeclaration add = col.AddMethod("Add" + name); ParameterDeclaration para = add.Signature.Parameters.Add(mappedType, pname, true); add.Body.Add( Expr.This.Prop("List").Method("Add").Invoke(para) ); // add method MethodDeclaration contains = col.AddMethod("Contains" + name); contains.Signature.ReturnType = new TypeTypeDeclaration(typeof(bool)); para = contains.Signature.Parameters.Add(mappedType, pname, true); contains.Body.Return( Expr.This.Prop("List").Method("Contains").Invoke(para) ); // add method MethodDeclaration remove = col.AddMethod("Remove" + name); para = remove.Signature.Parameters.Add(mappedType, pname, true); remove.Body.Add( Expr.This.Prop("List").Method("Remove").Invoke(para) ); }
public override void Execute(SolutionModel solutionModel, SelectionContext context) { FileModel fileModel; CodeSpan selection; if (!solutionModel.IsEditorSelection(context, out fileModel, out selection)) { return; } IMemberDeclaration memberDeclaration = fileModel.InnerMost <IMemberDeclaration>(selection); if (memberDeclaration.ExistsTextuallyInFile && !memberDeclaration.Identifier.CodeSpan.Intersects(selection)) { memberDeclaration.Identifier.Select(); } else { ITypeDeclaration typeDeclaration = fileModel.InnerMost <ITypeDeclaration>(selection); if (typeDeclaration.ExistsTextuallyInFile) { NavigateToTypeDeclaration(typeDeclaration, selection); } } }
private void FindMethods(ITypeDeclaration typeDeclaration, string[] searchFors, List <MethodDeclarationInfo> list) { foreach (IMethodDeclaration methodDeclaration in typeDeclaration.Methods) { try { string methodText = this.Decompile(methodDeclaration); bool found = false; foreach (string s in searchFors) { if (methodText.Contains(s)) { found = true; break; } } if (found) { list.Add(new MethodDeclarationInfo(methodDeclaration, methodText)); } } catch (Exception ex) { list.Add(new MethodDeclarationInfo(methodDeclaration, ex.Message)); } } foreach (ITypeDeclaration nestedType in typeDeclaration.NestedTypes) { FindMethods(nestedType, searchFors, list); } }
public override ITypeDeclaration Transform(ITypeDeclaration itd) { bool useJaggedSubarrayWithMarginal = (this.algorithmDefault is ExpectationPropagation); analysis = new VariableAnalysisTransform(useJaggedSubarrayWithMarginal); analysis.Context.InputAttributes = context.InputAttributes; analysis.Transform(itd); context.Results = analysis.Context.Results; var itdOut = base.Transform(itd); if (context.trackTransform) { IBlockStatement block = Builder.BlockStmt(); block.Statements.Add(Builder.CommentStmt("variablesOmittingVariableFactor:")); foreach (var ivd in analysis.variablesExcludingVariableFactor) { block.Statements.Add(Builder.CommentStmt(ivd.ToString())); } context.OutputAttributes.Add(itdOut, new DebugInfo() { Transform = this, Name = "analysis", Value = block }); } return(itdOut); }
public StaticPropertyInfo(string name, string desc, byte primitiveType) { Name = name; Description = desc; OverrideType = new DTokenDeclaration(primitiveType); ResolvedBaseTypeGetter = (t,ctxt) => new PrimitiveType(primitiveType) { NonStaticAccess = RequireThis }; }
private void ConvertNamespaceDeclaration(ITypeDeclaration declaringType, NamespaceDeclarationSyntax namespaceDeclaration) { foreach (var member in namespaceDeclaration.Members) { ConvertMember(declaringType, member); } }
protected internal BinaryFormula(NodeType nodeType, IFormula left, IFormula right, ITypeDeclaration type, IMethodDeclaration method, IFormula parent) : base(nodeType, type, parent) { Left = left; Method = method; Right = right; }
internal IGeneratedAlgorithm CompileWithoutParams(ITypeDeclaration itd, MethodBase method, AttributeRegistry <object, ICompilerAttribute> inputAttributes) { AttributeRegistry <object, ICompilerAttribute> outputAttributes = (AttributeRegistry <object, ICompilerAttribute>)inputAttributes.Clone(); List <ITypeDeclaration> output = GetTransformedDeclaration(itd, method, outputAttributes); return(CompileWithoutParams <IGeneratedAlgorithm>(output)); }
private IMethodDeclaration ConvertMethodDecl(ITypeDeclaration typeDeclaration, MethodDeclarationSyntax methodDeclarationSyntax) { var methodSymbol = model.GetDeclaredSymbol(methodDeclarationSyntax); var methodDecl = Builder.MethodDecl(); methodDecl.Name = methodSymbol.Name; methodDecl.DeclaringType = typeDeclaration; methodDecl.Static = methodSymbol.IsStatic; methodDecl.Visibility = ConvertVisibility(methodSymbol.DeclaredAccessibility); methodDecl.Virtual = methodSymbol.IsVirtual; methodDecl.Abstract = methodSymbol.IsAbstract; methodDecl.Final = methodSymbol.IsSealed; var methodReturnType = ConvertTypeReference(methodSymbol.ReturnType); methodDecl.ReturnType = Builder.MethodReturnType(methodReturnType); ConvertAttributes(methodDeclarationSyntax.AttributeLists, methodDecl.Attributes); foreach (var paramSym in methodSymbol.Parameters) { var paramDecl = Builder.Param(paramSym.Name, ConvertTypeReference(paramSym.Type)); methodDecl.Parameters.Add(paramDecl); } methodDecl.MethodInfo = Builder.ToMethodThrows(methodDecl); return(methodDecl); }
public override void VisitInner(ITypeDeclaration td) { if (PushSelectionRange(td)) { base.VisitInner(td); } }
protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) { ITypeDeclaration typeDeclaration = GetTargetTypeDeclaration(_highlighting.BaseClass); if (typeDeclaration == null) { return(null); } MemberSignature signature = CreateTransformTextSignature(typeDeclaration); TypeTarget target = CreateTarget(typeDeclaration); var context = new CreateMethodDeclarationContext { AccessRights = AccessRights.PUBLIC, ExecuteTemplateOverMemberBody = false, ExecuteTemplateOverName = false, ExecuteTemplateOverParameters = false, ExecuteTemplateOverReturnType = false, IsAbstract = true, IsStatic = false, MethodSignatures = new[] { signature }, MethodName = T4CSharpIntermediateConverterBase.TransformTextMethodName, SourceReferenceExpressionReference = null, Target = target, }; IntentionResult intentionResult = MethodDeclarationBuilder.Create(context); intentionResult.ExecuteTemplate(); return(null); }
public MethodSignature(IMethodDeclaration methDecl) { this.meth_decl = methDecl; this.name = meth_decl.Name; if (meth_decl.SpecialName) { this.m_type = MethodType.SpecialName; switch (this.name) { case "op_Implicit": this.m_type = MethodType.ImplicitCast; break; case "op_Explicit": this.m_type = MethodType.ExplicitCast; break; case ".cctor": this.m_type = MethodType.Constructor; break; case ".ctor": this.m_type = MethodType.StaticConstructor; break; default: string op; if (operators.TryGetValue(name, out op)) { this.name = op; this.m_type = MethodType.Operator; } break; } } else { this.m_type = MethodType.Ordinary; } type_decl = ((ITypeReference)methDecl.DeclaringType).Resolve(); }
public static AbstractType Demangle(string mangledString, out ITypeDeclaration qualifier, out bool isCFunction) { if(string.IsNullOrEmpty(mangledString)) throw new ArgumentException("строка ввода должна не быть пустой или null!"); if (!mangledString.StartsWith("_D")) { isCFunction = true; if (mangledString.StartsWith ("__D")) mangledString = mangledString.Substring (1); // C Functions else if (mangledString.StartsWith ("_")) { qualifier = new IdentifierDeclaration (mangledString.Substring (1)); return null; } } //TODO: What about C functions that start with 'D'? isCFunction = false; var dmng = new Demangler(mangledString); return dmng.MangledName(out qualifier); }
private static ICollection GetInterfaces(ITypeDeclaration value) { ArrayList list = new ArrayList(0); list.AddRange(value.Interfaces); if (value.BaseType != null) { ITypeDeclaration declaration2 = value.BaseType.Resolve(); foreach (ITypeReference reference in declaration2.Interfaces) { if (list.Contains(reference)) { list.Remove(reference); } } } foreach (ITypeReference reference in value.Interfaces) { ITypeDeclaration declaration = reference.Resolve(); foreach (ITypeReference reference2 in declaration.Interfaces) { if (list.Contains(reference2)) { list.Remove(reference2); } } } ITypeReference[] array = new ITypeReference[list.Count]; list.CopyTo(array, 0); return(array); }
internal FieldDeclaration(string name, Declaration declaringType, ITypeDeclaration type) : base(name,declaringType) { if (type==null) throw new ArgumentNullException("type"); this.type = type; }
public static AbstractType Demangle(string mangledString, out ITypeDeclaration qualifier, out bool isCFunction) { if (string.IsNullOrEmpty(mangledString)) { throw new ArgumentException("input string must not be null or empty!"); } if (!mangledString.StartsWith("_D")) { isCFunction = true; if (mangledString.StartsWith("__D")) { mangledString = mangledString.Substring(1); } // C Functions else if (mangledString.StartsWith("_")) { qualifier = new IdentifierDeclaration(mangledString.Substring(1)); return(null); } } //TODO: What about C functions that start with 'D'? isCFunction = false; var dmng = new Demangler(mangledString); return(dmng.MangledName(out qualifier)); }
public ObjectCreationExpression(ITypeDeclaration type, params Expression[] args) { if (type==null) throw new ArgumentNullException("type"); this.type = type; this.args.AddRange(args); }
internal IndexerDeclaration( Declaration declaringType, ITypeDeclaration returnType) : base("Item",declaringType) { this.signature.ReturnType = returnType; this.Attributes = MemberAttributes.Public; }
internal EventDeclaration(string name, Declaration declaringType, ITypeDeclaration type) : base(name,declaringType) { if (type==null) throw new ArgumentNullException("type"); this.type = type; this.Attributes = MemberAttributes.Public; }
public TypeData (ITypeDeclaration typeDecl) { Declaration = typeDecl; Type = Declaration.Type; Col = Declaration.Col; InputKnob = ResourceManager.GetTintedTexture (Declaration.InputKnobTexPath, Col); OutputKnob = ResourceManager.GetTintedTexture (Declaration.OutputKnobTexPath, Col); }
public TypeData (ITypeDeclaration typeDecl) { declaration = typeDecl; Type = declaration.Type; col = declaration.col; InputKnob = ResourceManager.GetTintedTexture (declaration.InputKnob_TexPath, col); OutputKnob = ResourceManager.GetTintedTexture (declaration.OutputKnob_TexPath, col); }
internal ParameterDeclaration(ITypeDeclaration type, string name, bool nonNull) { if (type==null) throw new ArgumentNullException("type"); if (name==null) throw new ArgumentNullException("name"); this.type = type; this.name=name; this.nonNull = nonNull; }
public CastExpression(ITypeDeclaration targetType, Expression expression) { if (targetType==null) throw new ArgumentNullException("targetType"); if (expression == null) throw new ArgumentNullException("expression"); this.targetType = targetType; this.expression = expression; }
public ArrayCreationWithInitializersExpression( ITypeDeclaration type, params Expression[] initializers) { if (type == null) throw new ArgumentNullException("type"); this.type = type; this.initializers.AddRange(initializers); }
/// <summary> /// Detects the nested types. /// </summary> /// <param name="typeDeclaration">The type declaration.</param> /// <returns>An IEnumerable of ITypeDeclaration with the nested types.</returns> private static IEnumerable<ITypeDeclaration> NestedTypes(ITypeDeclaration typeDeclaration) { foreach (ITypeDeclaration nestedType in typeDeclaration.NestedTypes) { yield return nestedType; foreach (ITypeDeclaration nestedNestedType in NestedTypes(nestedType)) { yield return nestedNestedType; } } }
public static IBlockFormula Block( IBlockFormula parentBlock, ReadOnlyCollection<IBlockFormula> childBlocks, ReadOnlyCollection<IFormula> variables, ReadOnlyCollection<IFormula> formulas, IFormula result, ITypeDeclaration type, IFormula parent) { return new BlockFormula(parentBlock, childBlocks, variables, formulas, result, type, parent); }
public DelegateCreateExpression(ITypeDeclaration delegateType, MethodReferenceExpression targetMethod) { if (delegateType==null) throw new ArgumentNullException("delegateType"); if (targetMethod==null) throw new ArgumentNullException("targetMethod"); this.delegateType = delegateType; this.targetMethod = targetMethod; }
protected internal MethodCallFormula( IFormula instance, IMethodDeclaration method, ReadOnlyCollection<IFormula> arguments, ITypeDeclaration type, IFormula parent) : base(NodeType.Call, type, parent) { Instance = instance; Method = method; Arguments = arguments; }
public ArrayCreationWithSizeExpression( ITypeDeclaration type, Expression sizeExpression) { if (type == null) throw new ArgumentNullException("type"); if (sizeExpression == null) throw new ArgumentNullException("sizeExpression"); this.type = type; this.sizeExpression = sizeExpression; }
public PredicateGrouping(ITypeDeclaration declaration, string regionType, Predicate<ITypeMemberDeclaration> predicate) : base(declaration) { if (regionType == null) throw new ArgumentNullException("regionType"); if(predicate == null) throw new ArgumentNullException("predicate"); this.regionType = regionType; this.predicate = predicate; }
/// <summary> /// Finds the derived types. /// </summary> /// <param name="typeDeclaration">The type declaration.</param> /// <returns>An IEnumerable'1 of ITypeDeclaration instances that are derived from the given type declaration.</returns> public IEnumerable<ITypeDeclaration> FindDerivedTypes(ITypeDeclaration typeDeclaration) { if (!this.table.ContainsKey(typeDeclaration)) { LiveSequence.Common.Logger.Current.Debug("no derived types in current table"); return new List<ITypeDeclaration>(); } List<ITypeDeclaration> list = this.table[typeDeclaration]; list.Sort(); return list; }
public VariableDeclarationStatement( ITypeDeclaration type, string name ) { if (type==null) throw new ArgumentNullException("type"); if (name==null) throw new ArgumentNullException("name"); this.type = type; this.name = name; }
public void MarkTypeAsUsed(ITypeDeclaration declaration) { //ITypeElement element = declaration.DeclaredElement; //UsageState mask = UsageState.USED_MASK | // UsageState.CANNOT_BE_PRIVATE | // UsageState.CANNOT_BE_INTERNAL | // UsageState.CANNOT_BE_PROTECTED; //SetConstructorsState(element, mask); //collectUsagesStageProcess.SetElementState(element, UsageState.ACCESSED); }
protected internal ConditionalFormulaRef( IFormulaRef test, IFormulaRef ifTrue, IFormulaRef ifFalse, ITypeDeclaration type, IFormulaRef parent) : base(test, ifTrue, ifFalse, type, parent) { this.parent = parent; this.test = test; this.ifTrue = ifTrue; this.ifFalse = ifFalse; }
/// <summary> /// Adds to table. /// </summary> /// <param name="keyTypeReference">The key type reference.</param> /// <param name="typeDeclaration">The type declaration.</param> private void AddToTable(ITypeReference keyTypeReference, ITypeDeclaration typeDeclaration) { if (!this.table.ContainsKey(keyTypeReference)) { this.table.Add(keyTypeReference, new List<ITypeDeclaration>()); } // Get the list that belongs to the given key List<ITypeDeclaration> list = this.table[keyTypeReference]; // Check if list already contains typeDeclaration; otherwise add it. if (list.Find(lookupDeclaration => lookupDeclaration == typeDeclaration) == null) { list.Add(typeDeclaration); } }