public GetClass ( string name ) : |
||
name | string | |
Résultat |
public void ProcessFileOut01() { ChunkReader chunkReader = new ChunkReader(@"FileOut01.st"); CodeReader reader = new CodeReader(chunkReader); CodeModel model = new CodeModel(); reader.Process(model); Assert.IsNotNull(model.GetClass("Object")); Assert.AreEqual(3, model.Elements.Count()); Assert.IsInstanceOfType(model.Elements.First(), typeof(ClassModel)); Assert.IsInstanceOfType(model.Elements.Skip(1).First(), typeof(MethodModel)); Assert.IsInstanceOfType(model.Elements.Skip(2).First(), typeof(MethodModel)); }
private void ProcessMethods(CodeModel model, MessageExpression expression) { string className = expression.Target.AsString(); ClassModel @class = model.GetClass(className); for (string chunk = this.reader.GetChunk(); chunk != null; chunk = this.reader.GetChunk()) { if (string.IsNullOrEmpty(chunk.Trim())) break; ModelParser parser = new ModelParser(chunk); MethodModel method = parser.ParseMethod(@class, false); model.AddElement(method); } }
private void ProcessMessageExpression(CodeModel model, MessageExpression expression) { // TODO implements weakSubclass if (expression.Selector.StartsWith("subclass:") || expression.Selector.StartsWith("weakSubclass:") || expression.Selector.StartsWith("variableSubclass:")) { bool isvariable = expression.Selector.StartsWith("variableSubclass:"); SymbolExpression symbol = (SymbolExpression)expression.Arguments.First(); VariableExpression variable = (VariableExpression)expression.Target; ClassModel super = null; if (variable.Name != null && variable.Name != symbol.Symbol) //// TODO review quick hack if class is not defined yet if (model.HasClass(variable.Name)) super = model.GetClass(variable.Name); ClassModel @class; if (super != null || variable.Name == null) @class = new ClassModel(symbol.Symbol, super, GetInstanceVariableNames(expression), GetClassVariableNames(expression), isvariable, GetPoolDictionariesNames(expression), GetCategory(expression)); else @class = new ClassModel(symbol.Symbol, variable.Name, GetInstanceVariableNames(expression), GetClassVariableNames(expression), isvariable, GetPoolDictionariesNames(expression), GetCategory(expression)); model.AddElement(@class); } }