public static TheClass Get(CsEntity pCsEntity, FactoryExpressionCreator pCreator) { if (pCsEntity == null) { return(null); } while (pCsEntity != null) { if (pCsEntity is CsEntityClass || pCsEntity is CsEntityStruct || pCsEntity is CsEntityInterface) { break; } pCsEntity = pCsEntity.parent; } CsEntityClass entityKlass = pCsEntity as CsEntityClass; if (entityKlass != null && entityKlass.nodes.Count != 0 && entityKlass.nodes.First.Value != null) { return(Get(entityKlass.nodes.First.Value, pCreator)); } CsEntityStruct entityStruct = pCsEntity as CsEntityStruct; if (entityStruct != null && entityStruct.nodes.Count != 0 && entityStruct.nodes.First.Value != null) { return(Get(entityStruct.nodes.First.Value, pCreator)); } CsEntityInterface entityInterface = pCsEntity as CsEntityInterface; if (entityInterface != null && entityInterface.nodes.Count != 0 && entityInterface.nodes.First.Value != null) { return(Get(entityInterface.nodes.First.Value, pCreator)); } if (pCsEntity != null) { if (!_entities.ContainsKey(pCsEntity)) { _entities[pCsEntity] = new TheClass(pCsEntity, pCreator); } return(_entities[pCsEntity]); } throw new Exception(); }
public TheProperty(CsProperty pCsProperty, TheClass pTheClass, FactoryExpressionCreator pCreator) { MyClass = pTheClass; Modifiers.AddRange(Helpers.GetModifiers(pCsProperty.modifiers)); Name = pCsProperty.identifier.identifier; FullName = MyClass.FullName + "." + Name; ReturnType = Helpers.GetType(pCsProperty.type); if (pCsProperty.getter != null) Getter = new Property(pCsProperty.getter, this); if (pCsProperty.setter != null) Setter = new Property(pCsProperty.setter, this); }
internal TheMethod(CsMethod pCsMethod, TheClass pMyClass, FactoryExpressionCreator pCreator) { MyClass = pMyClass; Modifiers.AddRange(Helpers.GetModifiers(pCsMethod.modifiers)); Arguments = getArguments(pCsMethod.parameters.parameters, pCreator); Signature = getSignature(Arguments); CodeBlock = pCsMethod.definition; //_sig = Signature.Replace(',', '_').Replace("<", "").Replace(">", ""); //_name = Helpers.GetRealName(pCsMethod, pCsMethod.identifier.identifier); _realName = _name = pCsMethod.identifier.identifier; //FullRealName = MyClass.FullRealName + "." + RealName; ReturnType = Helpers.GetType(pCsMethod.return_type); IsExtensionMethod = pCsMethod.entity.isExtensionMethod(); }
public TheConstant(CsConstantDeclaration pCsConstantDeclaration, TheClass pTheClass, FactoryExpressionCreator pCreator) { Modifiers.AddRange(Helpers.GetModifiers(pCsConstantDeclaration.modifiers)); foreach (CsConstantDeclarator declarator in pCsConstantDeclaration.declarators) { Constant v = new Constant { //RealName = declarator.identifier.identifier, //Name = Helpers.GetRealName(declarator, declarator.identifier.identifier), Name = declarator.identifier.identifier, Initializer = pCreator.Parse(declarator.expression), ReturnType = Helpers.GetType(declarator.entity.type) }; v.Modifiers.AddRange(Modifiers); Constants.Add(v); } }
internal TheVariable(CsVariableDeclaration pCsVariableDeclaration, TheClass pTheClass, FactoryExpressionCreator pCreator) { Modifiers.AddRange(Helpers.GetModifiers(pCsVariableDeclaration.modifiers)); foreach (CsVariableDeclarator declarator in pCsVariableDeclaration.declarators) { Variable v = new Variable { //RealName = declarator.identifier.identifier, //Name = Helpers.GetRealName(declarator, declarator.identifier.identifier), Name = declarator.identifier.identifier, Initializer = declarator.initializer == null ? null : pCreator.Parse(declarator.initializer as CsExpression), ReturnType = Helpers.GetType(declarator.entity.type) }; v.Modifiers.AddRange(Modifiers); Variables.Add(v); } }
internal TheMethod(CsEntityMethod pCsMethod, TheClass pMyClass, FactoryExpressionCreator pCreator, bool pIsEvent = false, bool pIsAddEvent = false) { MyClass = pMyClass; //Modifiers.AddRange(Helpers.GetModifiers(pCsMethod.access)); Arguments = getArguments(pCsMethod.parameters, pCreator); Signature = getSignature(Arguments); //_name = Helpers.GetRealName(pCsMethod, pIsEvent ? // pIsAddEvent ? "add" : "remove" : // pCsMethod.name); _name = pIsEvent ? pIsAddEvent ? "add" : "remove" : pCsMethod.name; _realName = pCsMethod.name; //FullRealName = MyClass.FullRealName + "." + RealName; ReturnType = Helpers.GetType(pCsMethod.specifier.return_type); IsExtensionMethod = pCsMethod.isExtensionMethod(); }
public TheEvent(CsEvent pCsEvent, TheClass pTheClass, FactoryExpressionCreator pCreator) { MyClass = pTheClass; if (pCsEvent.declarators.Count > 1) throw new Exception("No more than one event declaration per handler is supported"); _declarator = pCsEvent.declarators.First.Value; Name = _declarator.identifier.identifier;//RealName = //FullRealName = MyClass.FullRealName + "." + RealName; FullName = MyClass.FullName + "." + Name; Modifiers.AddRange(Helpers.GetModifiers(pCsEvent.modifiers)); string eventName = Helpers.GetEventFromAttr(pCsEvent.attributes, pCreator); IsFlashEvent = !string.IsNullOrEmpty(eventName); Add = new TheMethod(_declarator.entity.add, pTheClass, pCreator, true, true); Remove = new TheMethod(_declarator.entity.remove, pTheClass, pCreator, true); EventName = Helpers.GetEventFromAttr(pCsEvent.attributes, pCreator); }
public TheProperty(CsProperty pCsProperty, TheClass pTheClass, FactoryExpressionCreator pCreator) { MyClass = pTheClass; Modifiers.AddRange(Helpers.GetModifiers(pCsProperty.modifiers)); Name = pCsProperty.identifier.identifier; FullName = MyClass.FullName + "." + Name; ReturnType = Helpers.GetType(pCsProperty.type); if (pCsProperty.getter != null) { Getter = new Property(pCsProperty.getter, this); } if (pCsProperty.setter != null) { Setter = new Property(pCsProperty.setter, this); } }
public static TheClass Get(CsNode pNode, FactoryExpressionCreator pCreator) { if (pNode == null) return null; CsExpression csExpression = pNode as CsExpression; if (csExpression != null && csExpression.ec != expression_classification.ec_nothing) { return Get((CsEntity)csExpression.entity, pCreator); } while (pNode != null) { if (pNode is CsTypeRef || pNode is CsClass || pNode is CsInterface) { break; } pNode = pNode.parent; } CsClass klass = pNode as CsClass; if (klass != null) { if (!_classes.ContainsKey(klass)) _classes[klass] = new TheClass(klass, pCreator); return _classes[klass]; } CsTypeRef csTypeRef = pNode as CsTypeRef; if (csTypeRef != null) { return csTypeRef.entity_typeref == null ? null : Get((CsEntityClass)(csTypeRef.entity_typeref.u), pCreator); } CsInterface csInterface = pNode as CsInterface; if (csInterface != null) { if (!_interfaces.ContainsKey(csInterface)) _interfaces[csInterface] = new TheClass(csInterface, pCreator); return _interfaces[csInterface]; } throw new Exception(); }
internal TheConstructor(CsConstructor pConstructor, TheClass pMyClass, FactoryExpressionCreator pCreator) { _constructor = pConstructor; _creator = pCreator; MyClass = pMyClass; Modifiers.AddRange(Helpers.GetModifiers(pConstructor.modifiers)); Arguments = getArguments(pConstructor.parameters.parameters, pCreator); BaseArguments = Helpers.GetCallingArguments(pConstructor.argument_list, pCreator); Signature = getSignature(Arguments); CodeBlock = pConstructor.definition; HasBaseCall = pConstructor.basethis == CsTokenType.tkBASE; LinkedList<CsFormalParameter> csFormalParameters = pConstructor.parameters.parameters; _noFormalParams = csFormalParameters == null; _name = pConstructor.identifier.identifier; IsStaticConstructor = (pConstructor.modifiers.flags & (uint)CsModifierEnum.mSTATIC) != 0; if (pConstructor.basethis == CsTokenType.tkBASE || pConstructor.basethis == CsTokenType.tkTHIS) { _baseConstructor = pConstructor.basethis == CsTokenType.tkBASE ? (CsEntityClass)((CsEntityClass)pConstructor.entity.parent).base_type.u : ((CsEntityClass)pConstructor.entity.parent); } }
public static TheClass Get(CsEntity pCsEntity, FactoryExpressionCreator pCreator) { if (pCsEntity == null) return null; while (pCsEntity != null) { if (pCsEntity is CsEntityClass || pCsEntity is CsEntityStruct || pCsEntity is CsEntityInterface) { break; } pCsEntity = pCsEntity.parent; } CsEntityClass entityKlass = pCsEntity as CsEntityClass; if (entityKlass != null && entityKlass.nodes.Count != 0 && entityKlass.nodes.First.Value != null) { return Get(entityKlass.nodes.First.Value, pCreator); } CsEntityStruct entityStruct = pCsEntity as CsEntityStruct; if (entityStruct != null && entityStruct.nodes.Count != 0 && entityStruct.nodes.First.Value != null) { return Get(entityStruct.nodes.First.Value, pCreator); } CsEntityInterface entityInterface = pCsEntity as CsEntityInterface; if (entityInterface != null && entityInterface.nodes.Count != 0 && entityInterface.nodes.First.Value != null) { return Get(entityInterface.nodes.First.Value, pCreator); } if (pCsEntity != null) { if (!_entities.ContainsKey(pCsEntity)) _entities[pCsEntity] = new TheClass(pCsEntity, pCreator); return _entities[pCsEntity]; } throw new Exception(); }
internal TheIndexer(CsIndexer pIndexer, TheClass pMyClass, FactoryExpressionCreator pCreator) { MyClass = pMyClass; _creator = pCreator; Arguments = getArguments(pIndexer.parameters.parameters, pCreator); Signature = getSignature(Arguments); ReturnType = Helpers.GetType(pIndexer.entity.specifier.return_type); Modifiers.AddRange(Helpers.GetModifiers(pIndexer.modifiers)); //Name = Helpers.GetRealName(pIndexer, pIndexer.entity.name); Name = pIndexer.entity.name; FullName = MyClass.FullName + "." + Name; //FullRealName = MyClass.FullRealName + "." + RealName; string sig = Signature.Replace(',', '_').Replace("<", "").Replace(">", ""); if (pIndexer.getter != null) { Getter = processIndexer(pIndexer.getter, false, sig); } if (pIndexer.setter != null) { Setter = processIndexer(pIndexer.setter, true, sig); } }
public TheDelegate(CsDelegate pCsDelegate, TheClass pTheClass, FactoryExpressionCreator pCreator) { }