当前位置: 首页>>代码示例>>C#>>正文


C# ASResult类代码示例

本文整理汇总了C#中ASResult的典型用法代码示例。如果您正苦于以下问题:C# ASResult类的具体用法?C# ASResult怎么用?C# ASResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ASResult类属于命名空间,在下文中一共展示了ASResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenameMember

 static void RenameMember(ClassModel inClass, string name, string newName, bool outputResults)
 {
     MemberModel m = inClass.Members.Items.FirstOrDefault(it => it.Name == name);
     if (m == null) return;
     ASResult result = new ASResult();
     ASComplete.FindMember(name, inClass, result, FlagType.Dynamic | FlagType.Function, 0);
     if (result.Member == null) return;
     queue.Add(new Rename(result, outputResults, newName));
 }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:9,代码来源:RenamingHelper.cs

示例2: FindGetterSetter

 internal static ASResult FindGetterSetter(ASResult target, string name)
 {
     var inClass = target.InClass;
     var members = inClass.Members.Items;
     for (int i = 0, length = members.Count; i < length; i++)
     {
         var member = members[i];
         if (member.Name == name)
         {
             var result = new ASResult();
             ASComplete.FindMember(name, inClass, result, FlagType.Dynamic | FlagType.Function, 0);
             if (result.Member != null)
             {
                 return result;
             }
         }
     }
     return null;
 }
开发者ID:xeronith,项目名称:flashdevelop,代码行数:19,代码来源:RenamingHelper.cs

示例3: AddToQueue

 public static void AddToQueue(ASResult target, bool outputResults)
 {
     string originalName = RefactoringHelper.GetRefactorTargetName(target);
     string label = TextHelper.GetString("Label.NewName");
     string title = string.Format(TextHelper.GetString("Title.RenameDialog"), originalName);
     LineEntryDialog askName = new LineEntryDialog(title, label, originalName);
     if (askName.ShowDialog() == DialogResult.OK)
     {
         string newName = askName.Line.Trim();
         if (newName.Length == 0 || newName == originalName) return;
         queue.Add(new Rename(target, outputResults, newName));
         if (ASContext.Context.CurrentModel.haXe && target.Member != null &&
             (target.Member.Flags & (FlagType.Getter | FlagType.Setter)) > 0)
         {
             List<MemberModel> list = target.Member.Parameters;
             if (list[0].Name == "get") RenameMember(target.InClass, "get_" + originalName, "get_" + newName, outputResults);
             if (list[1].Name == "set") RenameMember(target.InClass, "set_" + originalName, "set_" + newName, outputResults);
         }
         if (currentCommand == null) ExecuteFirst();
     }
 }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:21,代码来源:RenamingHelper.cs

示例4: FindTargetInFiles

 /// <summary>
 /// Finds the given target in all project files.
 /// If the target is a local variable or function parameter, it will only search the associated file.
 /// Note: if running asynchronously, you must supply a listener to "findFinishedHandler" to retrieve the results.
 /// If running synchronously, do not set listeners and instead use the return value.
 /// </summary>
 /// <param name="target">the source member to find references to</param>
 /// <param name="progressReportHandler">event to fire as search results are compiled</param>
 /// <param name="findFinishedHandler">event to fire once searching is finished</param>
 /// <param name="asynchronous">executes in asynchronous mode</param>
 /// <returns>If "asynchronous" is false, will return the search results, otherwise returns null on bad input or if running in asynchronous mode.</returns>
 public static FRResults FindTargetInFiles(ASResult target, FRProgressReportHandler progressReportHandler, FRFinishedHandler findFinishedHandler, Boolean asynchronous)
 {
     Boolean currentFileOnly = false;
     // checks target is a member
     if (target == null || ((target.Member == null || String.IsNullOrEmpty(target.Member.Name))
         && (target.Type == null || !CheckFlag(target.Type.Flags, FlagType.Class) && !target.Type.IsEnum())))
     {
         return null;
     }
     else
     {
         // if the target we are trying to rename exists as a local variable or a function parameter we only need to search the current file
         if (target.Member != null && (
                 target.Member.Access == Visibility.Private
                 || RefactoringHelper.CheckFlag(target.Member.Flags, FlagType.LocalVar)
                 || RefactoringHelper.CheckFlag(target.Member.Flags, FlagType.ParameterVar))
             )
         {
             currentFileOnly = true;
         }
     }
     FRConfiguration config;
     IProject project = PluginBase.CurrentProject;
     String file = PluginBase.MainForm.CurrentDocument.FileName;
     // This is out of the project, just look for this file...
     if (currentFileOnly || !IsProjectRelatedFile(project, file))
     {
         String mask = Path.GetFileName(file);
         String path = Path.GetDirectoryName(file);
         if (mask.Contains("[model]"))
         {
             if (findFinishedHandler != null)
             {
                 findFinishedHandler(new FRResults());
             }
             return null;
         }
         config = new FRConfiguration(path, mask, false, GetFRSearch(target.Member != null ? target.Member.Name : target.Type.Name));
     }
     else if (target.Member != null && !CheckFlag(target.Member.Flags, FlagType.Constructor))
     {
         config = new FRConfiguration(GetAllProjectRelatedFiles(project), GetFRSearch(target.Member.Name));
     }
     else
     {
         target.Member = null;
         config = new FRConfiguration(GetAllProjectRelatedFiles(project), GetFRSearch(target.Type.Name));
     }
     config.CacheDocuments = true;
     FRRunner runner = new FRRunner();
     if (progressReportHandler != null)
     {
         runner.ProgressReport += progressReportHandler;
     }
     if (findFinishedHandler != null)
     {
         runner.Finished += findFinishedHandler;
     }
     if (asynchronous) runner.SearchAsync(config);
     else return runner.SearchSync(config);
     return null;
 }
开发者ID:thecocce,项目名称:flashdevelop,代码行数:73,代码来源:RefactoringHelper.cs

示例5: ShowGetSetList

 private static void ShowGetSetList(FoundDeclaration found)
 {
     string name = GetPropertyNameFor(found.member);
     ASResult result = new ASResult();
     ClassModel curClass = ASContext.Context.CurrentClass;
     ASComplete.FindMember(name, curClass, result, FlagType.Getter, 0);
     bool hasGetter = !result.IsNull();
     ASComplete.FindMember(name, curClass, result, FlagType.Setter, 0);
     bool hasSetter = !result.IsNull();
     if (hasGetter && hasSetter) return;
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     if (!hasGetter && !hasSetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateGetSet");
         known.Add(new GeneratorItem(label, GeneratorJobType.GetterSetter, found.member, found.inClass));
     }
     if (!hasGetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateGet");
         known.Add(new GeneratorItem(label, GeneratorJobType.Getter, found.member, found.inClass));
     }
     if (!hasSetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateSet");
         known.Add(new GeneratorItem(label, GeneratorJobType.Setter, found.member, found.inClass));
     }
     CompletionList.Show(known, false);
 }
开发者ID:zaynyatyi,项目名称:flashdevelop,代码行数:28,代码来源:ASGenerator.cs

示例6: StatementReturnType

 public StatementReturnType(ASResult resolve, Int32 position, String word)
 {
     this.resolve = resolve;
     this.position = position;
     this.word = word;
 }
开发者ID:zaynyatyi,项目名称:flashdevelop,代码行数:6,代码来源:ASGenerator.cs

示例7: GenerateImplementation

        private static void GenerateImplementation(ClassModel aType, int position)
        {
            List<string> typesUsed = new List<string>();

            StringBuilder sb = new StringBuilder(TemplateUtils.ReplaceTemplateVariable(TemplateUtils.GetTemplate("ImplementHeader"), "Class", aType.Type));
            sb.Append(NewLine);
            bool entry = true;
            ASResult result = new ASResult();
            IASContext context = ASContext.Context;
            ClassModel cClass = context.CurrentClass;
            ContextFeatures features = context.Features;
            bool canGenerate = false;

            aType.ResolveExtends(); // resolve inheritance chain
            while (!aType.IsVoid() && aType.QualifiedName != "Object")
            {
                foreach (MemberModel method in aType.Members)
                {
                    if ((method.Flags & (FlagType.Function | FlagType.Getter | FlagType.Setter)) == 0
                        || method.Name == aType.Name)
                        continue;

                    // check if method exists
                    ASComplete.FindMember(method.Name, cClass, result, method.Flags, 0);
                    if (!result.IsNull()) continue;

                    string decl = entry ? NewLine : "";
                    if ((method.Flags & FlagType.Getter) > 0)
                        decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Getter"));
                    else if ((method.Flags & FlagType.Setter) > 0)
                        decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Setter"));
                    else
                        decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Function"));
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Member", "_" + method.Name);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Void", features.voidKey);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Body", null);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "BlankLine", NewLine);

                    if (!entry)
                    {
                        decl = TemplateUtils.ReplaceTemplateVariable(decl, "EntryPoint", null);
                    }

                    decl += NewLine;

                    entry = false;

                    sb.Append(decl);
                    canGenerate = true;

                    addTypeOnce(typesUsed, getQualifiedType(method.Type, aType));

                    if (method.Parameters != null && method.Parameters.Count > 0)
                        foreach (MemberModel param in method.Parameters)
                            addTypeOnce(typesUsed, getQualifiedType(param.Type, aType));
                }
                // interface inheritance
                aType = aType.Extends;
            }
            if (!canGenerate)
                return;

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;
            Sci.BeginUndoAction();
            try
            {
                position = Sci.CurrentPos;
                if (ASContext.Context.Settings.GenerateImports && typesUsed.Count > 0)
                {
                    int offset = AddImportsByName(typesUsed, Sci.LineFromPosition(position));
                    position += offset;
                    Sci.SetSel(position, position);
                }
                InsertCode(position, sb.ToString());
            }
            finally { Sci.EndUndoAction(); }
        }
开发者ID:zaynyatyi,项目名称:flashdevelop,代码行数:77,代码来源:ASGenerator.cs

示例8: ParseFunctionParameters

        private static List<FunctionParameter> ParseFunctionParameters(ScintillaNet.ScintillaControl Sci, int p)
        {
            List<FunctionParameter> prms = new List<FunctionParameter>();
            StringBuilder sb = new StringBuilder();
            List<ASResult> types = new List<ASResult>();
            bool isFuncStarted = false;
            bool isDoubleQuote = false;
            bool isSingleQuote = false;
            bool wasEscapeChar = false;
            bool doBreak = false;
            bool writeParam = false;
            int subClosuresCount = 0;
            ASResult result = null;
            IASContext ctx = ASContext.Context;
            char[] charsToTrim = new char[] { ' ', '\t', '\r', '\n' };
            int counter = Sci.TextLength; // max number of chars in parameters line (to avoid infinitive loop)
            string characterClass = ScintillaNet.ScintillaControl.Configuration.GetLanguage(Sci.ConfigurationLanguage).characterclass.Characters;
            int lastMemberPos = p;

            // add [] and <>
            while (p < counter && !doBreak)
            {
                char c = (char)Sci.CharAt(p++);
                if (c == '(' && !isFuncStarted)
                {
                    if (sb.ToString().Trim(charsToTrim).Length == 0)
                    {
                        isFuncStarted = true;
                    }
                    else
                    {
                        break;
                    }
                }
                else if (c == ';' && !isFuncStarted)
                {
                    break;
                }
                else if (c == ')' && isFuncStarted && !wasEscapeChar && !isDoubleQuote && !isSingleQuote && subClosuresCount == 0)
                {
                    isFuncStarted = false;
                    writeParam = true;
                    doBreak = true;
                }
                else if ((c == '(' || c == '[' || c == '<' || c == '{') && !wasEscapeChar && !isDoubleQuote && !isSingleQuote)
                {
                    if (subClosuresCount == 0)
                    {
                        if (c == '{')
                        {
                            if (sb.ToString().TrimStart().Length > 0)
                            {
                                result = new ASResult();
                                result.Type = ctx.ResolveType("Function", null);
                                types.Insert(0, result);
                            }
                            else
                            {
                                result = new ASResult();
                                result.Type = ctx.ResolveType(ctx.Features.objectKey, null);
                                types.Insert(0, result);
                            }
                        }
                        else if (c == '(')
                        {
                            result = ASComplete.GetExpressionType(Sci, lastMemberPos + 1);
                            if (!result.IsNull())
                            {
                                types.Insert(0, result);
                            }
                        }
                        else if (c == '<')
                        {
                            if (sb.ToString().TrimStart().Length == 0)
                            {
                                result = new ASResult();
                                result.Type = ctx.ResolveType("XML", null);
                                types.Insert(0, result);
                            }
                        }
                    }
                    subClosuresCount++;
                    sb.Append(c);
                    wasEscapeChar = false;
                }
                else if ((c == ')' || c == ']' || c == '>' || c == '}') && !wasEscapeChar && !isDoubleQuote && !isSingleQuote)
                {
                    if (c == ']')
                    {
                        result = ASComplete.GetExpressionType(Sci, p);
                        if (result.Type != null) result.Member = null;
                        else result.Type = ctx.ResolveType(ctx.Features.arrayKey, null);
                        types.Insert(0, result);
                        writeParam = true;
                    }
                    subClosuresCount--;
                    sb.Append(c);
                    wasEscapeChar = false;
                }
                else if (c == '\\')
//.........这里部分代码省略.........
开发者ID:zaynyatyi,项目名称:flashdevelop,代码行数:101,代码来源:ASGenerator.cs

示例9: DelegateMethodsCommand

 public DelegateMethodsCommand(ASResult result, Dictionary<MemberModel, ClassModel> selectedMembers)
 {
     this.result = result;
     this.selectedMembers = selectedMembers;
 }
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:5,代码来源:DelegateMethodsCommand.cs

示例10: GetRefactoringTarget

 public static MemberModel GetRefactoringTarget(ASResult target)
 {
     var type = target.Type;
     var member = target.Member;
     if (type.IsEnum() || !type.IsVoid() && target.IsStatic && (member == null || (member.Flags & FlagType.Constructor) > 0))
         return type;
     return member;
 }
开发者ID:xeronith,项目名称:flashdevelop,代码行数:8,代码来源:RefactoringHelper.cs

示例11: DoesMatchPointToTarget

 /// <summary>
 /// Checks if a given search match actually points to the given target source
 /// </summary
 /// <returns>True if the SearchMatch does point to the target source.</returns>
 static public bool DoesMatchPointToTarget(ScintillaNet.ScintillaControl Sci, SearchMatch match, ASResult target, DocumentHelper associatedDocumentHelper)
 {
     if (Sci == null || target == null || target.inFile == null || target.Member == null)
     {
         return false;
     }
     // get type at match position
     ASResult result = DeclarationLookupResult(Sci, Sci.MBSafePosition(match.Index) + Sci.MBSafeTextLength(match.Value));
     if (associatedDocumentHelper != null)
     {
         // because the declaration lookup opens a document, we should register it with the document helper to be closed later
         associatedDocumentHelper.RegisterLoadedDocument(PluginBase.MainForm.CurrentDocument);
     }
     // check if the result matches the target
     // TODO: this method of checking their equality seems pretty crude -- is there a better way?
     if (result == null || result.inFile == null || result.Member == null)
     {
         return false;
     }
     Boolean doesMatch = result.inFile.BasePath == target.inFile.BasePath && result.inFile.FileName == target.inFile.FileName && result.Member.LineFrom == target.Member.LineFrom && result.Member.Name == target.Member.Name;
     return (doesMatch);
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:26,代码来源:RefactoringHelper.cs

示例12: FindTargetInFiles

 /// <summary>
 /// Finds the given target in all project files.
 /// If the target is a local variable or function parameter, it will only search the associated file.
 /// Note: if running asynchronously, you must supply a listener to "findFinishedHandler" to retrieve the results.
 /// If running synchronously, do not set listeners and instead use the return value.
 /// </summary>
 /// <param name="target">the source member to find references to</param>
 /// <param name="progressReportHandler">event to fire as search results are compiled</param>
 /// <param name="findFinishedHandler">event to fire once searching is finished</param>
 /// <param name="asynchronous">executes in asynchronous mode</param>
 /// <returns>If "asynchronous" is false, will return the search results, otherwise returns null on bad input or if running in asynchronous mode.</returns>
 public static FRResults FindTargetInFiles(ASResult target, FRProgressReportHandler progressReportHandler, FRFinishedHandler findFinishedHandler, Boolean asynchronous)
 {
     Boolean currentFileOnly = false;
     // checks target is a member
     if (target == null || ((target.Member == null || target.Member.Name == null || target.Member.Name == String.Empty) && (target.Type == null || CheckFlag(FlagType.Class, target.Type.Flags))))
     {
         return null;
     }
     else
     {
         // if the target we are trying to rename exists as a local variable or a function parameter we only need to search the current file
         if (target.Member != null && (RefactoringHelpera.CheckFlag(target.Member.Flags, FlagType.LocalVar) || RefactoringHelpera.CheckFlag(target.Member.Flags, FlagType.ParameterVar)))
         {
             currentFileOnly = true;
         }
     }
     // sets the FindInFiles settings to the project root, *.as files, and recursive
     String path = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
     if (!PluginBase.MainForm.CurrentDocument.FileName.StartsWith(path))
     {
         // This is out of the project, just look for this file...
         currentFileOnly = true;
     }
     String mask = "*.as;*.hx";
     Boolean recursive = true;
     // but if it's only the current file, let's just search that!
     if (currentFileOnly)
     {
         path = Path.GetDirectoryName(PluginBase.MainForm.CurrentDocument.FileName);
         mask = Path.GetFileName(PluginBase.MainForm.CurrentDocument.FileName);
         recursive = false;
     }
     FRConfiguration config = new FRConfiguration(path, mask, recursive, GetFRSearch(target.Member.Name));
     config.CacheDocuments = true;
     FRRunner runner = new FRRunner();
     if (progressReportHandler != null)
     {
         runner.ProgressReport += progressReportHandler;
     }
     if (findFinishedHandler != null)
     {
         runner.Finished += findFinishedHandler;
     }
     if (asynchronous) runner.SearchAsync(config);
     else return runner.SearchSync(config);
     return null;
 }
开发者ID:Dsnoi,项目名称:flashdevelopjp,代码行数:58,代码来源:RefactoringHelpera.cs

示例13: UpdateHighlightUnderCursor

 /// <summary>
 /// 
 /// </summary>
 private void UpdateHighlightUnderCursor(ScintillaControl sci)
 {
     string file = PluginBase.MainForm.CurrentDocument.FileName;
     if (!IsValidFile(file)) return;
     int currentPos = sci.CurrentPos;
     string newToken = sci.GetWordFromPosition(currentPos);
     if (!string.IsNullOrEmpty(newToken)) newToken = newToken.Trim();
     if (!string.IsNullOrEmpty(newToken))
     {
         if (prevResult == null && prevToken == newToken) return;
         ASResult result = IsValidFile(file) ? ASComplete.GetExpressionType(sci, sci.WordEndPosition(currentPos, true)) : null;
         if (result != null && !result.IsNull())
         {
             if (prevResult != null && (result.Member != prevResult.Member || result.Type != prevResult.Type || result.Path != prevResult.Path)) return;
             RemoveHighlights(sci);
             prevToken = newToken;
             prevResult = result;
             List<SearchMatch> matches = FilterResults(GetResults(sci, prevToken), result, sci);
             if (matches == null || matches.Count == 0) return;
             highlightUnderCursorTimer.Stop();
             AddHighlights(sci, matches);
         }
         else RemoveHighlights(sci);
     }
     else RemoveHighlights(sci);
 }
开发者ID:nujond,项目名称:fd-highlight-selected-plugin,代码行数:29,代码来源:PluginMain.cs

示例14: ResolveTopLevelElement

        /// <summary>
        /// Top-level elements lookup
        /// </summary>
        /// <param name="token">Element to search</param>
        /// <param name="result">Response structure</param>
        public override void ResolveTopLevelElement(string token, ASResult result)
        {
            if (topLevel != null && topLevel.Members.Count > 0)
            {
                // current class
                ClassModel inClass = ASContext.Context.CurrentClass;
                if (token == "this")
                {
                    result.Member = topLevel.Members.Search("this", 0, 0);
                    if (inClass.IsVoid())
                        inClass = ASContext.Context.ResolveType(result.Member.Type, null);
                    result.Type = inClass;
                    result.InFile = ASContext.Context.CurrentModel;
                    return;
                }
                else if (token == "super")
                {
                    if (inClass.IsVoid())
                    {
                        MemberModel thisMember = topLevel.Members.Search("this", 0, 0);
                        inClass = ASContext.Context.ResolveType(thisMember.Type, null);
                    }
                    inClass.ResolveExtends();
                    ClassModel extends = inClass.Extends;
                    if (!extends.IsVoid())
                    {
                        result.Member = topLevel.Members.Search("super", 0, 0);
                        result.Type = extends;
                        result.InFile = extends.InFile;
                        return;
                    }
                }

                // other top-level elements
                ASComplete.FindMember(token, topLevel, result, 0, 0);
                if (!result.IsNull()) return;

                // special _levelN
                if (hasLevels && token.StartsWith("_") && re_level.IsMatch(token))
                {
                    result.Member = new MemberModel();
                    result.Member.Name = token;
                    result.Member.Flags = FlagType.Variable;
                    result.Member.Type = "MovieClip";
                    result.Type = ResolveType("MovieClip", null);
                    result.InFile = topLevel;
                }
            }
        }
开发者ID:thecocce,项目名称:flashdevelop,代码行数:54,代码来源:Context.cs

示例15: GenerateImplementation

        private static void GenerateImplementation(ClassModel iType, ClassModel inClass, ScintillaControl sci, bool detached)
        {
            List<string> typesUsed = new List<string>();

            StringBuilder sb = new StringBuilder();

            string header = TemplateUtils.ReplaceTemplateVariable(TemplateUtils.GetTemplate("ImplementHeader"), "Class",
                iType.Type);

            header = TemplateUtils.ReplaceTemplateVariable(header, "BlankLine", detached ? BlankLine : null);

            sb.Append(header);
            sb.Append(NewLine);
            bool entry = true;
            ASResult result = new ASResult();
            IASContext context = ASContext.Context;
            ContextFeatures features = context.Features;
            bool canGenerate = false;
            bool isHaxe = IsHaxe;
            FlagType flags = (FlagType.Function | FlagType.Getter | FlagType.Setter);
            if (isHaxe) flags |= FlagType.Variable;

            iType.ResolveExtends(); // resolve inheritance chain
            while (!iType.IsVoid() && iType.QualifiedName != "Object")
            {
                foreach (MemberModel method in iType.Members)
                {
                    if ((method.Flags & flags) == 0
                        || method.Name == iType.Name)
                        continue;

                    // check if method exists
                    ASComplete.FindMember(method.Name, inClass, result, method.Flags, 0);
                    if (!result.IsNull()) continue;

                    string decl;
                    if ((method.Flags & FlagType.Getter) > 0)
                    {
                        if (isHaxe)
                        {
                            decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Property"));

                            string templateName = null;
                            string metadata = null;
                            if (method.Parameters[0].Name == "get")
                            {
                                if (method.Parameters[1].Name == "set")
                                {
                                    templateName = "GetterSetter";
                                    metadata = "@:isVar";
                                }
                                else
                                    templateName = "Getter";
                            }
                            else if (method.Parameters[1].Name == "set")
                            {
                                templateName = "Setter";
                            }

                            decl = TemplateUtils.ReplaceTemplateVariable(decl, "MetaData", metadata);

                            if (templateName != null)
                            {
                                var accessor = NewLine + TemplateUtils.ToDeclarationString(method, TemplateUtils.GetTemplate(templateName));
                                accessor = TemplateUtils.ReplaceTemplateVariable(accessor, "Modifiers", null);
                                accessor = TemplateUtils.ReplaceTemplateVariable(accessor, "Member", method.Name);
                                decl += accessor;
                            }
                        }
                        else
                            decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Getter"));
                    }
                    else if ((method.Flags & FlagType.Setter) > 0)
                        decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Setter"));
                    else if ((method.Flags & FlagType.Function) > 0)
                        decl = TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Function"));
                    else
                        decl = NewLine + TemplateUtils.ToDeclarationWithModifiersString(method, TemplateUtils.GetTemplate("Variable"));
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Member", "_" + method.Name);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Void", features.voidKey);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "Body", null);
                    decl = TemplateUtils.ReplaceTemplateVariable(decl, "BlankLine", NewLine);

                    if (!entry)
                    {
                        decl = TemplateUtils.ReplaceTemplateVariable(decl, "EntryPoint", null);
                    }

                    decl += NewLine;

                    entry = false;

                    sb.Append(decl);
                    canGenerate = true;

                    AddTypeOnce(typesUsed, GetQualifiedType(method.Type, iType));

                    if (method.Parameters != null && method.Parameters.Count > 0)
                        foreach (MemberModel param in method.Parameters)
                            AddTypeOnce(typesUsed, GetQualifiedType(param.Type, iType));
//.........这里部分代码省略.........
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:101,代码来源:ASGenerator.cs


注:本文中的ASResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。