Ejemplo n.º 1
0
 internal Definition(string documentation, DefinitionKind kind, Scope scope, TrackingSpan span)
 {
     this.Kind           = kind;
     this.Documentation  = documentation;
     this.Scope          = scope;
     this.DefinitionSpan = span;
 }
Ejemplo n.º 2
0
 protected Definition(ColoredString name, string documentation, DefinitionKind kind, Scope scope, TrackingSpan span)
 {
     this.Name           = name;
     this.Kind           = kind;
     this.Documentation  = documentation;
     this.Scope          = scope;
     this.DefinitionSpan = span;
 }
Ejemplo n.º 3
0
 public GetAddInEntitiesEventArgs(IBase baseObject, DefinitionKind definitionKind, BaseType dataType, EntityFactory entityFactory, Func <IEnumerable <IBase> > getCurrentChildren, string propertyName = null)
 {
     this.BaseObject         = baseObject;
     this.DefinitionKind     = definitionKind;
     this.Entities           = new List <IBase>();
     this.EntityFactory      = entityFactory;
     this.PropertyName       = propertyName;
     this.Type               = dataType;
     this.GetCurrentChildren = getCurrentChildren;
 }
Ejemplo n.º 4
0
        public AssemblyType(System.Type baseType, BaseObject parent, bool genericParent = false) : base(parent)
        {
            this.baseType = baseType;
            this.parent   = parent;

            if (parent is MethodOperation)
            {
                if (genericParent)
                {
                    this.FolderKeyPair = "Return Type Generic Arguments;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Method Return Type Generic Argument";

                    notNavigable = true;
                }
                else
                {
                    this.FolderKeyPair = "Return Type;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Method Return Type";

                    notNavigable = true;
                }
            }
            else if (parent is Assembly)
            {
                if (baseType.Namespace != null && baseType.Namespace.Length > 0)
                {
                    this.FolderKeyPair = baseType.Namespace + ";AssemblyProvider.Web.Images.Namespace.png";
                }
            }
            else if (parent is AssemblyType)
            {
                if (genericParent)
                {
                    this.FolderKeyPair = "Generic Arguments;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Class Generic Argument";

                    notNavigable = true;
                }
                else
                {
                    this.FolderKeyPair = "Base Types;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Class Base Type";

                    notNavigable = true;
                }
            }
            else if (parent is FieldElement)
            {
                description = "Field Type";
            }
            else if (parent is GetSetPropertyElement)
            {
                description = "GetSet Property Type";
            }
            else if (parent is PropertyElement)
            {
                description = "Property Type";
            }

            if (baseType.BaseType != null && (baseType.BaseType.FullName == "System.MulticastDelegate" || baseType.BaseType.FullName == "System.Delegate"))
            {
                imageURL          = "AssemblyProvider.Web.Images.Delegate.png";
                this.childOrdinal = 5.0f;

                kind = DefinitionKind.Delegate;
            }
            else if (baseType.IsEnum)
            {
                imageURL          = "AssemblyProvider.Web.Images.Enum.png";
                this.childOrdinal = 4.0f;

                kind = DefinitionKind.Enumeration;
            }
            else if (baseType.IsInterface)
            {
                imageURL          = "AssemblyProvider.Web.Images.Interface.png";
                this.childOrdinal = 3.0f;

                kind = DefinitionKind.Interface;
            }
            else if (baseType.IsClass)
            {
                imageURL          = "AssemblyProvider.Web.Images.Struct.png";
                this.childOrdinal = 2.0f;

                kind = DefinitionKind.Class;
            }
            else
            {
                imageURL          = string.Empty;
                this.childOrdinal = 1.0f;

                kind = DefinitionKind.Structure;
            }
        }
Ejemplo n.º 5
0
        public AssemblyType(BaseType baseType, BaseObject parent) : base(parent)
        {
            try
            {
                this.baseType = System.Type.GetType(baseType.AssemblyQualifiedName, true);
                this.parent   = parent;

                if (parent is MethodOperation)
                {
                    this.FolderKeyPair = "Return Type;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Method Return Type";

                    notNavigable = true;
                }
                else if (parent is Assembly)
                {
                    if (baseType.Namespace != null && baseType.Namespace.Length > 0)
                    {
                        this.FolderKeyPair = baseType.Namespace + ";AssemblyProvider.Web.Images.Namespace.png";
                    }
                }
                else if (parent is AssemblyType)
                {
                    this.FolderKeyPair = "Base Types;AssemblyProvider.Web.Images.Folder.png";
                    description        = "Class Base Type";

                    notNavigable = true;
                }
                else if (parent is FieldElement)
                {
                    description = "Field Type";
                }
                else if (parent is GetSetPropertyElement)
                {
                    description = "GetSet Property Type";
                }
                else if (parent is PropertyElement)
                {
                    description = "Property Type";
                }

                if (baseType.UnderlyingType.BaseType != null && (baseType.UnderlyingType.BaseType.FullName == "System.MulticastDelegate" || baseType.UnderlyingType.BaseType.FullName == "System.Delegate"))
                {
                    imageURL          = "AssemblyProvider.Web.Images.Delegate.png";
                    this.childOrdinal = 5.0f;

                    kind = DefinitionKind.Delegate;
                }
                else if (baseType.UnderlyingType.IsEnum)
                {
                    imageURL          = "AssemblyProvider.Web.Images.Enum.png";
                    this.childOrdinal = 4.0f;

                    kind = DefinitionKind.Enumeration;
                }
                else if (baseType.UnderlyingType.IsInterface)
                {
                    imageURL          = "AssemblyProvider.Web.Images.Interface.png";
                    this.childOrdinal = 3.0f;

                    kind = DefinitionKind.Interface;
                }
                else if (!baseType.UnderlyingType.IsClass)
                {
                    imageURL          = "AssemblyProvider.Web.Images.Struct.png";
                    this.childOrdinal = 2.0f;

                    kind = DefinitionKind.Class;
                }
                else
                {
                    imageURL          = string.Empty;
                    this.childOrdinal = 1.0f;

                    kind = DefinitionKind.Structure;
                }
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }
        }
Ejemplo n.º 6
0
        public static bool recordSymbolDefinitionKind(int symbolId, DefinitionKind symbolDefinitionKind)
        {
            bool ret = sourcetraildbPINVOKE.recordSymbolDefinitionKind(symbolId, (int)symbolDefinitionKind);

            return(ret);
        }
Ejemplo n.º 7
0
 public VariableDefinition(IReadOnlyList <SyntaxType> typeQualifier, TypeDefinition type, ColoredString name, IReadOnlyList <ColoredString> arraySpecifiers, string documentation, DefinitionKind kind, Scope scope, TrackingSpan span)
     : base(name, documentation, kind, scope, span)
 {
     this.TypeQualifiers  = typeQualifier ?? new List <SyntaxType>();
     this.Type            = type;
     this.ArraySpecifiers = arraySpecifiers ?? new List <ColoredString>();
 }
Ejemplo n.º 8
0
 protected VariableDefinition(string documentation, DefinitionKind kind, Scope scope, TrackingSpan span) : base(documentation, kind, scope, span)
 {
 }
Ejemplo n.º 9
0
        public UserVariableDefinition(StructDeclaratorSyntax declarator, IdentifierSyntax identifier, string documentation, DefinitionKind kind, Scope scope)
            : base(documentation, kind, scope, identifier.Span)
        {
            if (kind == DefinitionKind.LocalVariable)
            {
                this.Name = ColoredString.Create(identifier.Identifier, ColorType.LocalVariable);
            }
            else
            {
                this.Name = ColoredString.Create(identifier.Identifier, ColorType.GlobalVariable);
            }

            InterfaceBlockSyntax block = declarator.Parent as InterfaceBlockSyntax;

            this.TypeQualifiers = block.TypeQualifier?.ToSyntaxTypes() ?? new List <SyntaxType>();
            this.Type           = new TypeDefinition(SyntaxType.TypeName);

            List <ColoredString> arraySpecifiers = new List <ColoredString>();

            for (int i = 0; i < declarator.ArraySpecifiers.Count; i++)
            {
                arraySpecifiers.AddRange(declarator.ArraySpecifiers[i].ToColoredString());
            }

            this.ArraySpecifiers = arraySpecifiers;
        }
Ejemplo n.º 10
0
        public UserVariableDefinition(ConditionSyntax condition, IdentifierSyntax identifier, string documentation, DefinitionKind kind, Scope scope)
            : base(documentation, kind, scope, identifier.Span)
        {
            if (kind == DefinitionKind.LocalVariable)
            {
                this.Name = ColoredString.Create(identifier.Identifier, ColorType.LocalVariable);
            }
            else
            {
                this.Name = ColoredString.Create(identifier.Identifier, ColorType.GlobalVariable);
            }

            this.TypeQualifiers  = condition.TypeQualifier?.ToSyntaxTypes() ?? new List <SyntaxType>();
            this.Type            = new TypeDefinition(condition.TypeSyntax);
            this.ArraySpecifiers = new List <ColoredString>();
        }
Ejemplo n.º 11
0
        private void EnsureDefinition(Instance inst, IDefinition def)
        {
            DefinitionKind dk      = (DefinitionKind)def.UserData;
            bool           addInst = (inst != null);
            Matrix         m       = (inst == null) ? Matrix.Identity : inst.Transformations[0].Matrix;

            if ((dk & DefinitionKind.Ignore) == 0)
            {
                if (((dk & DefinitionKind.JointMarker) != 0) && (inst != null))
                {
                    V2DJointKind jointKind = jointKindMap[jointKinds.IndexOf(def.Name)];
                    ParseJoint(jointKind, inst);
                }
                else if (((dk & DefinitionKind.ShapeMarker) != 0) && (inst != null))
                {
                    if (!parentStack.Peek().Definition.IsDefined)
                    {
                        parentStack.Peek().Definition.AddShapes(curVo, def, m);
                    }
                }

                if ((dk & DefinitionKind.TextField) != 0)
                {
                    Text txt = (Text)def;
                    if (def.Name == null)
                    {
                        def.Name = "$tx_" + def.Id;
                    }
                    Definition2D d2d = GetTextDefinition(m, txt);
                    if (txt.TextRuns.Count > 0 && !txt.TextRuns[0].isEditable)
                    {
                        AddSymbolImage(def);
                    }

                    if (addInst)
                    {
                        AddInstance(inst, def);
                    }
                }

                if ((dk & DefinitionKind.Timeline) != 0)
                {
                    Definition2D d2d = GetDefinition2D(m, def);

                    Instance2D i2d;
                    if (addInst)
                    {
                        i2d = AddInstance(inst, def);
                    }
                    else
                    {
                        i2d = CreateInstance2D(def);
                    }
                    parentStack.Push(i2d);
                    ParseTimeline((Timeline)def);
                    i2d.Definition.IsDefined = true;
                    parentStack.Pop();
                }

                if ((dk & DefinitionKind.Symbol) != 0)
                {
                    // todo: this is just adding images
                    //Body2D b2d = CreateBody2D(inst, def);
                    if (def.Name == null)
                    {
                        def.Name = "$sym_" + def.Id;
                    }
                    Definition2D d2d = GetDefinition2D(m, def);
                    AddSymbolImage(def);

                    if (addInst)
                    {
                        AddInstance(inst, def);
                    }
                }

                if ((dk & DefinitionKind.Vex2D) != 0)
                {
                    Definition2D d2d = GetDefinition2D(m, def);

                    if (!isDefined.Contains(def.Id))
                    {
                        isDefined.Add(def.Id);
                        d2d.AddShapes(curVo, def, m);
                        //parentStack.Peek().Definition.AddShapes(curVo, def, m);
                    }

                    Instance2D i2d;
                    if (addInst)
                    {
                        i2d = AddInstance(inst, def);
                    }
                    else
                    {
                        i2d = CreateInstance2D(def);
                    }

                    parentStack.Push(i2d);
                    ParseTimeline((Timeline)def);
                    i2d.Definition.IsDefined = true;
                    parentStack.Pop();
                }
            }

            if (!isDefined.Contains(def.Id))
            {
                isDefined.Add(def.Id);
            }
        }
Ejemplo n.º 12
0
 public ModuleKindHandlerAttribute(Enum moduleKind, DefinitionKind definitionKind, UIFeatureKind featureKind)
 {
     this.ModuleKind     = moduleKind;
     this.DefinitionKind = definitionKind;
     this.FeatureKind    = featureKind;
 }
 public AngularModuleKindHandlerAttribute(ModuleKind moduleKind, DefinitionKind definitionKind, UIFeatureKind featureKind = UIFeatureKind.None) : base(moduleKind, definitionKind, featureKind)
 {
 }
Ejemplo n.º 14
0
        private void ParseTimeline(Timeline t)
        {
            List <IInstance> insts = t.Instances;

            foreach (IInstance instance in insts)
            {
                if (!(instance is Instance))
                {
                    continue;
                }
                Instance inst = (Instance)instance;
                if (inst.Name == null)
                {
                    inst.Name = "$inst_" + instAutoNumber++;
                }

                IDefinition    def = curVo.Definitions[inst.DefinitionId];
                DefinitionKind dk  = (DefinitionKind)def.UserData;

                if ((dk & DefinitionKind.Ignore) != 0)
                {
                    continue;
                }

                if ((dk & DefinitionKind.JointMarker) != 0)
                {
                    V2DJointKind jointKind = Enum.Parse(V2DJointKind, def.Name, true);
                    ParseJoint(jointKind, inst);
                }

                if ((dk & DefinitionKind.ShapeMarker) != 0)
                {
                }

                if ((dk & DefinitionKind.TextField) != 0)
                {
                    Text txt = (Text)def;
                }

                if ((dk & DefinitionKind.Timeline) != 0)
                {
                    V2DDefinition vd = CreateDefinition(inst, def);
                    V2DInstance   vi = CreateInstance(inst, vd);

                    parentStack.Push(vi);
                    ParseTimeline((Timeline)def);
                    parentStack.Pop();
                }

                if ((dk & DefinitionKind.Symbol) != 0)
                {
                    V2DInstance vi = CreateInstance(inst, def);
                }

                if ((dk & DefinitionKind.Vex2D) != 0)
                {
                    // todo: this is just adding images and/or instances
                    Body2D b2d = CreateDefinition(inst, def);
                    b2d.AddShapes(curVo, def, inst);
                }
            }
            GenerateJointData();
        }
Ejemplo n.º 15
0
        public Definition AddDefinition(SyntaxNode node, IdentifierSyntax identifier, DefinitionKind type)
        {
            if (this.testModeLayer > 0)
            {
                return(null);
            }

            if (identifier == null || node == null)
            {
                return(null);
            }

            Scope      definitionScope = new Scope(this.snapshot.CreateTrackingPoint(identifier.Span.GetSpan(this.snapshot).Start), this.scope.Peek().End);
            Definition definition      = null;

            switch (type)
            {
            case DefinitionKind.Function:
                definition = this.lastFunctionDefinition = new UserFunctionDefinition(node as FunctionHeaderSyntax, identifier, string.Empty, definitionScope);
                break;

            case DefinitionKind.Parameter:
                definition = new UserParameterDefinition(node as ParameterSyntax, identifier, string.Empty, definitionScope);
                this.lastFunctionDefinition?.InternalParameters.Add(definition as UserParameterDefinition);
                break;

            case DefinitionKind.Field:
                definition = new UserFieldDefinition(node as StructDeclaratorSyntax, identifier, string.Empty, definitionScope);

                if (this.lastStructDefinition is UserTypeNameDefinition)
                {
                    (this.lastStructDefinition as UserTypeNameDefinition)?.InternalFields.Add(definition as UserFieldDefinition);
                }
                else
                {
                    (this.lastStructDefinition as UserTypeNameDefinition)?.InternalFields.Add(definition as UserFieldDefinition);
                }

                break;

            case DefinitionKind.GlobalVariable:
            case DefinitionKind.LocalVariable:

                switch (node.SyntaxType)
                {
                case SyntaxType.InitPart:
                    definition = new UserVariableDefinition(node as InitPartSyntax, identifier, string.Empty, type, definitionScope);
                    break;

                case SyntaxType.Condition:
                    definition = new UserVariableDefinition(node as ConditionSyntax, identifier, string.Empty, type, definitionScope);
                    break;

                case SyntaxType.StructDeclarator:
                    definition = new UserVariableDefinition(node as StructDeclaratorSyntax, identifier, string.Empty, type, definitionScope);
                    break;
                }

                break;

            case DefinitionKind.Macro:
                definition = new UserMacroDefinition(node as DefinePreprocessorSyntax, identifier, string.Empty, definitionScope);
                break;

            case DefinitionKind.TypeName:
                definition = new UserTypeNameDefinition(identifier, string.Empty, definitionScope);
                this.lastStructDefinition = definition;
                break;

            case DefinitionKind.InterfaceBlock:
                definition = new UserInterfaceBlockDefinition(node as InterfaceBlockSyntax, identifier, string.Empty, definitionScope);
                this.lastStructDefinition = definition;
                break;
            }

            if (this.definitions.ContainsKey(definition.Name.Text))
            {
                this.definitions[definition.Name.Text].Add(definition);
            }
            else
            {
                this.definitions.Add(definition.Name.Text, new List <Definition> {
                    definition
                });
            }

            definition.Overloads = this.definitions[definition.Name.Text];

            return(definition);
        }