public override object Visit(AST.FieldDeclaration fieldDeclaration, object data) { DefaultRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation); Class c = (Class)currentClass.Peek(); ReturnType type = null; if (fieldDeclaration.TypeReference == null) { Debug.Assert(c.ClassType == ClassType.Enum); } else { type = new ReturnType(fieldDeclaration.TypeReference); } if (currentClass.Count > 0) { foreach (AST.VariableDeclaration field in fieldDeclaration.Fields) { Field f = new Field(type, field.Name, fieldDeclaration.Modifier, region); c.Fields.Add(f); } } return(null); }
public static DefaultRegion GetRegion() { DefaultRegion rd = new DefaultRegion(0, 0, 0, 0); rd.FileName = ""; return(rd); }
public override object Visit(AST.PropertyDeclaration propertyDeclaration, object data) { DefaultRegion region = GetRegion(propertyDeclaration.StartLocation, propertyDeclaration.EndLocation); DefaultRegion bodyRegion = GetRegion(propertyDeclaration.BodyStart, propertyDeclaration.BodyEnd); ReturnType type = new ReturnType(propertyDeclaration.TypeReference); Class c = (Class)currentClass.Peek(); Property property = new Property(propertyDeclaration.Name, type, propertyDeclaration.Modifier, region, bodyRegion); c.Properties.Add(property); return(null); }
public override int GetHashCode() { int hash = 1; if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Lang.Length != 0) { hash ^= Lang.GetHashCode(); } if (ScriptId.Length != 0) { hash ^= ScriptId.GetHashCode(); } if (DefaultRegion.Length != 0) { hash ^= DefaultRegion.GetHashCode(); } if (HasMoreScripts != false) { hash ^= HasMoreScripts.GetHashCode(); } if (HasStemming != false) { hash ^= HasStemming.GetHashCode(); } if (Alphabet.Length != 0) { hash ^= Alphabet.GetHashCode(); } if (AlphabetUpper.Length != 0) { hash ^= AlphabetUpper.GetHashCode(); } if (WordSpellCheckLcid != 0) { hash ^= WordSpellCheckLcid.GetHashCode(); } if (GoogleTransId.Length != 0) { hash ^= GoogleTransId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static DefaultRegion GetRegion(NCC.Location cloc) { try { DefaultRegion reg = new DefaultRegion(cloc.Line, cloc.Column, cloc.EndLine, cloc.EndColumn); reg.FileName = cloc.File; return(reg); } catch { return(GetRegion()); } }
public override object Visit(AST.IndexerDeclaration indexerDeclaration, object data) { DefaultRegion region = GetRegion(indexerDeclaration.StartLocation, indexerDeclaration.EndLocation); DefaultRegion bodyRegion = GetRegion(indexerDeclaration.BodyStart, indexerDeclaration.BodyEnd); ParameterCollection parameters = new ParameterCollection(); Indexer i = new Indexer(new ReturnType(indexerDeclaration.TypeReference), parameters, indexerDeclaration.Modifier, region, bodyRegion); if (indexerDeclaration.Parameters != null) { foreach (AST.ParameterDeclarationExpression par in indexerDeclaration.Parameters) { ReturnType parType = new ReturnType(par.TypeReference); Parameter p = new Parameter(par.ParameterName, parType); parameters.Add(p); } } Class c = (Class)currentClass.Peek(); c.Indexer.Add(i); return(null); }
public override object Visit(AST.EventDeclaration eventDeclaration, object data) { DefaultRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation); DefaultRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd); ReturnType type = new ReturnType(eventDeclaration.TypeReference); Class c = (Class)currentClass.Peek(); Event e = null; if (eventDeclaration.VariableDeclarators != null) { foreach (JRefactory.Parser.AST.VariableDeclaration varDecl in eventDeclaration.VariableDeclarators) { e = new Event(varDecl.Name, type, eventDeclaration.Modifier, region, bodyRegion); c.Events.Add(e); } } else { e = new Event(eventDeclaration.Name, type, eventDeclaration.Modifier, region, bodyRegion); c.Events.Add(e); } return(null); }
public override object Visit(AST.ConstructorDeclaration constructorDeclaration, object data) { DefaultRegion region = GetRegion(constructorDeclaration.StartLocation, constructorDeclaration.EndLocation); DefaultRegion bodyRegion = GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body != null ? constructorDeclaration.Body.EndLocation : new Point(-1, -1)); Class c = (Class)currentClass.Peek(); Constructor constructor = new Constructor(constructorDeclaration.Modifier, region, bodyRegion); ParameterCollection parameters = new ParameterCollection(); if (constructorDeclaration.Parameters != null) { foreach (AST.ParameterDeclarationExpression par in constructorDeclaration.Parameters) { ReturnType parType = new ReturnType(par.TypeReference); Parameter p = new Parameter(par.ParameterName, parType); parameters.Add(p); } } constructor.Parameters = parameters; c.Methods.Add(constructor); return(null); }
public override object Visit(AST.TypeDeclaration typeDeclaration, object data) { DefaultRegion region = GetRegion(typeDeclaration.StartLocation, typeDeclaration.EndLocation); Class c = new Class(cu, TranslateClassType(typeDeclaration.Type), typeDeclaration.Modifier, region); if (currentClass.Count > 0) { Class cur = ((Class)currentClass.Peek()); cur.InnerClasses.Add(c); c.FullyQualifiedName = String.Concat(cur.FullyQualifiedName, '.', typeDeclaration.Name); } else { if (currentNamespace.Count == 0) { c.FullyQualifiedName = typeDeclaration.Name; } else { c.FullyQualifiedName = String.Concat(currentNamespace.Peek(), '.', typeDeclaration.Name); } cu.Classes.Add(c); } if (typeDeclaration.BaseTypes != null) { foreach (string type in typeDeclaration.BaseTypes) { c.BaseTypes.Add(type); } } currentClass.Push(c); object ret = typeDeclaration.AcceptChildren(this, data); currentClass.Pop(); c.UpdateModifier(); return(ret); }
public override object Visit(AST.MethodDeclaration methodDeclaration, object data) { DefaultRegion region = GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation); DefaultRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : new Point(-1, -1)); // Console.WriteLine(region + " --- " + bodyRegion); ReturnType type = new ReturnType(methodDeclaration.TypeReference); Class c = (Class)currentClass.Peek(); Method method = new Method(String.Concat(methodDeclaration.Name), type, methodDeclaration.Modifier, region, bodyRegion); ParameterCollection parameters = new ParameterCollection(); if (methodDeclaration.Parameters != null) { foreach (AST.ParameterDeclarationExpression par in methodDeclaration.Parameters) { ReturnType parType = new ReturnType(par.TypeReference); Parameter p = new Parameter(par.ParameterName, parType); parameters.Add(p); } } method.Parameters = parameters; c.Methods.Add(method); return(null); }
public static DefaultRegion GetRegion () { DefaultRegion rd = new DefaultRegion (0, 0, 0, 0); rd.FileName = ""; return rd; }
public static DefaultRegion GetRegion (NCC.Location cloc) { try { DefaultRegion reg = new DefaultRegion (cloc.Line, cloc.Column, cloc.EndLine, cloc.EndColumn); reg.FileName = cloc.File; return reg; } catch { return GetRegion (); } }