Repository: flex-falcon Updated Branches: refs/heads/develop 2a23f7bb9 -> 9981ec5f9
Added base ASDoc comment and tag API and implementation. - Fixed warning in FlexJSProject Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9981ec5f Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9981ec5f Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9981ec5f Branch: refs/heads/develop Commit: 9981ec5f9894dc87d0b6fbbd0b94e5c311450037 Parents: 2a23f7b Author: Michael Schmalle <[email protected]> Authored: Thu Jun 11 17:20:30 2015 -0400 Committer: Michael Schmalle <[email protected]> Committed: Thu Jun 11 17:20:30 2015 -0400 ---------------------------------------------------------------------- .../compiler/asdoc/flexjs/ASDocComment.java | 50 ++++- .../internal/projects/FlexJSProject.java | 92 ++++----- compiler/.settings/org.eclipse.jdt.core.prefs | 22 ++- .../flex/compiler/asdoc/ASDocComment.java | 197 +++++++++++++++++-- .../flex/compiler/asdoc/IASDocComment.java | 16 ++ .../apache/flex/compiler/asdoc/IASDocTag.java | 29 +++ 6 files changed, 342 insertions(+), 64 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java b/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java index b44253c..eedf79a 100644 --- a/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java +++ b/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java @@ -19,7 +19,12 @@ package org.apache.flex.compiler.asdoc.flexjs; +import java.util.Collection; +import java.util.List; +import java.util.Map; + import org.apache.flex.compiler.asdoc.IASDocComment; +import org.apache.flex.compiler.asdoc.IASDocTag; import antlr.Token; @@ -30,9 +35,9 @@ public class ASDocComment implements IASDocComment { token = t; } - + Token token; - + public String commentNoEnd() { String s = token.getText(); @@ -52,4 +57,45 @@ public class ASDocComment implements IASDocComment } return sb.toString(); } + + @Override + public String getDescription() + { + return null; + } + + @Override + public void compile() + { + } + + @Override + public boolean hasTag(String name) + { + return false; + } + + @Override + public IASDocTag getTag(String name) + { + return null; + } + + @Override + public Map<String, List<IASDocTag>> getTags() + { + return null; + } + + @Override + public Collection<IASDocTag> getTagsByName(String string) + { + return null; + } + + @Override + public void paste(IASDocComment source) + { + } + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java index e8f4af3..4bc69a3 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java @@ -19,7 +19,6 @@ package org.apache.flex.compiler.internal.projects; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Set; @@ -65,12 +64,12 @@ public class FlexJSProject extends FlexProject public void addDependency(ICompilationUnit from, ICompilationUnit to, DependencyType dt, String qname) { - // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation + // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation List<IDefinition> dp = to.getDefinitionPromises(); - + if (dp.size() == 0) return; - + IDefinition def = dp.get(0); // IDefinition def = to.getDefinitionPromises().get(0); IDefinition actualDef = ((DefinitionPromise) def).getActualDefinition(); @@ -92,8 +91,8 @@ public class FlexJSProject extends FlexProject // inheritance is important so remember it if (reqs.get(qname) != DependencyType.INHERITANCE) { - if (!isExternalLinkage(to)) - reqs.put(qname, dt); + if (!isExternalLinkage(to)) + reqs.put(qname, dt); } } else if (!isExternalLinkage(to)) @@ -105,7 +104,7 @@ public class FlexJSProject extends FlexProject if (from != to) { HashMap<String, String> interfacesArr; - + if (interfaces.containsKey(from)) { interfacesArr = interfaces.get(from); @@ -115,40 +114,43 @@ public class FlexJSProject extends FlexProject interfacesArr = new HashMap<String, String>(); interfaces.put(from, interfacesArr); } - + if (!interfacesArr.containsKey(qname)) { interfacesArr.put(qname, qname); } } } - + super.addDependency(from, to, dt, qname); } private LinkageChecker linkageChecker; private ITargetSettings ts; - + private boolean isExternalLinkage(ICompilationUnit cu) { - if (linkageChecker == null) - { - ts = getTargetSettings(); - linkageChecker = new LinkageChecker(this, ts); - } - // in unit tests, ts may be null and LinkageChecker NPEs - if (ts == null) - return false; - - try { - return linkageChecker.isExternal(cu); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return false; + if (linkageChecker == null) + { + ts = getTargetSettings(); + linkageChecker = new LinkageChecker(this, ts); + } + // in unit tests, ts may be null and LinkageChecker NPEs + if (ts == null) + return false; + + try + { + return linkageChecker.isExternal(cu); + } + catch (InterruptedException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return false; } - + public ArrayList<String> getInterfaces(ICompilationUnit from) { if (interfaces.containsKey(from)) @@ -178,30 +180,30 @@ public class FlexJSProject extends FlexProject } JSCSSCompilationSession cssSession = new JSCSSCompilationSession(); - + @Override public CSSCompilationSession getCSSCompilationSession() { - // When building SWFs, each MXML document may have its own styles - // specified by fx:Style blocks. The CSS is separately compiled and - // stored in the class definition for the MXML document. That helps - // with deferred loading of classes. The styles and thus the - // classes for an MXML document are not initialized until the MXML - // class is initialized. - // For JS compilation, the CSS for non-standard CSS could be done the - // same way, but AFAICT, standard CSS properties are best loaded by - // specifying a .CSS file in the HTML. The CSS is probably less text - // than its codegen'd representation, and the browser can probably - // load a .CSS file faster than us trying to run code to update the - // styles. - // So, for FlexJS, all style blocks from all MXML files are gathered into - // one .css file and a corresponding codegen block that is output as - // part of the main .JS file. - return cssSession; + // When building SWFs, each MXML document may have its own styles + // specified by fx:Style blocks. The CSS is separately compiled and + // stored in the class definition for the MXML document. That helps + // with deferred loading of classes. The styles and thus the + // classes for an MXML document are not initialized until the MXML + // class is initialized. + // For JS compilation, the CSS for non-standard CSS could be done the + // same way, but AFAICT, standard CSS properties are best loaded by + // specifying a .CSS file in the HTML. The CSS is probably less text + // than its codegen'd representation, and the browser can probably + // load a .CSS file faster than us trying to run code to update the + // styles. + // So, for FlexJS, all style blocks from all MXML files are gathered into + // one .css file and a corresponding codegen block that is output as + // part of the main .JS file. + return cssSession; } private HashMap<IASNode, String> astCache = new HashMap<IASNode, String>(); - + @Override public void addToASTCache(IASNode ast) { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler/.settings/org.eclipse.jdt.core.prefs ---------------------------------------------------------------------- diff --git a/compiler/.settings/org.eclipse.jdt.core.prefs b/compiler/.settings/org.eclipse.jdt.core.prefs index 6dc995b..4e1c882 100644 --- a/compiler/.settings/org.eclipse.jdt.core.prefs +++ b/compiler/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,3 @@ -#Tue Jun 26 14:15:39 EDT 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 @@ -104,12 +103,14 @@ org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 @@ -129,13 +130,14 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=false +org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=false @@ -147,6 +149,7 @@ org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not inse org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 @@ -165,11 +168,16 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert @@ -217,6 +225,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -235,12 +244,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -264,6 +275,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert @@ -291,6 +303,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -319,6 +332,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert @@ -328,6 +342,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -354,4 +369,5 @@ org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler/src/org/apache/flex/compiler/asdoc/ASDocComment.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/asdoc/ASDocComment.java b/compiler/src/org/apache/flex/compiler/asdoc/ASDocComment.java index a18a721..aa3826d 100644 --- a/compiler/src/org/apache/flex/compiler/asdoc/ASDocComment.java +++ b/compiler/src/org/apache/flex/compiler/asdoc/ASDocComment.java @@ -20,49 +20,89 @@ package org.apache.flex.compiler.asdoc; import java.io.StringReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; -import org.apache.flex.compiler.asdoc.IASDocComment; import org.apache.flex.compiler.internal.parsing.as.ASDocToken; import org.apache.flex.compiler.internal.parsing.as.ASDocTokenizer; +import org.apache.flex.compiler.internal.parsing.as.ASToken; import org.apache.flex.compiler.internal.parsing.as.ASTokenTypes; +import org.apache.flex.compiler.tree.as.IDocumentableDefinitionNode; import antlr.Token; public class ASDocComment implements IASDocComment { - public ASDocComment(Token t) + private ASToken token; + + @SuppressWarnings("unused") + private IDocumentableDefinitionNode node; + + private String description; + + Map<String, List<IASDocTag>> tags = new TreeMap<String, List<IASDocTag>>(); + + public ASDocComment(ASToken token, IDocumentableDefinitionNode node) + { + this.token = token; + this.node = node; + } + + /** + * @param token The asdoc token. + */ + public ASDocComment(Token token) + { + this.token = (ASToken)token; + } + + @Override + public void compile() { - token = t; + if (token == null) + return; + String data = token.getText(); ASDocTokenizer tokenizer = new ASDocTokenizer(false); tokenizer.setReader(new StringReader(data)); ASDocToken tok = tokenizer.next(); boolean foundDescription = false; + ASDocTag pendingTag = null; try { while (tok != null) { - if (!foundDescription - && tok.getType() == ASTokenTypes.TOKEN_ASDOC_TEXT) + if (!foundDescription && tok.getType() == ASTokenTypes.TOKEN_ASDOC_TEXT) { - System.out.println("ASDOC Text: " + tok.getText() ); - foundDescription = true; + description = tok.getText(); } else { // do tags if (tok.getType() == ASTokenTypes.TOKEN_ASDOC_TAG) { - System.out.println("ASDOC Tag: " + tok.getText() ); + if (pendingTag != null) + { + addTag(pendingTag); + pendingTag = null; + } + pendingTag = new ASDocTag(tok.getText().substring(1)); } else if (tok.getType() == ASTokenTypes.TOKEN_ASDOC_TEXT) { - System.out.println("ASDOC Description: " + tok.getText() ); + pendingTag.setDescription(tok.getText()); + addTag(pendingTag); + pendingTag = null; } } + foundDescription = true; + tok = tokenizer.next(); } } @@ -71,11 +111,140 @@ public class ASDocComment implements IASDocComment e.printStackTrace(); } } - - Token token; - - public Token getToken() + + private void addTag(ASDocTag tag) + { + List<IASDocTag> list = tags.get(tag.getName()); + if (list == null) + { + list = new ArrayList<IASDocTag>(); + tags.put(tag.getName(), list); + } + list.add(tag); + } + + @Override + public String toString() + { + return "ASASDocComment [description=" + description + "]"; + } + + @Override + public String getDescription() { - return token; + return description; } + + //-------------------------------------------------------------------------- + // ASDocTag + //-------------------------------------------------------------------------- + + class ASDocTag implements IASDocTag + { + private String name; + private String description; + + public ASDocTag(String name) + { + if (name.indexOf('@') == 0) + name = name.substring(1); + this.setName(name); + } + + public ASDocTag(String name, String description) + { + this(name); + setDescription(description); + } + + @Override + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + @Override + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + @Override + public boolean hasDescription() + { + return description != null && !description.equals(""); + } + } + + @Override + public boolean hasTag(String name) + { + List<IASDocTag> list = tags.get(name); + if (list == null || list.size() == 0) + return false; + return true; + } + + @Override + public IASDocTag getTag(String name) + { + List<IASDocTag> list = tags.get(name); + if (list == null || list.size() == 0) + return null; + return list.get(0); + } + + @Override + public Map<String, List<IASDocTag>> getTags() + { + // TODO return unmodifiable + return tags; + } + + @Override + public List<IASDocTag> getTagsByName(String name) + { + List<IASDocTag> result = new ArrayList<IASDocTag>(); + List<IASDocTag> list = tags.get(name); + if (list == null) + return result; + + for (IASDocTag tag : list) + { + result.add(tag); + } + return result; + } + + @Override + public void paste(IASDocComment source) + { + // + description = source.getDescription(); + IASDocTag tag; + if (source.hasTag("return")) + { + tag = source.getTag("return"); + addTag(new ASDocTag(tag.getName(), tag.getDescription())); + } + if (source.hasTag("param")) + { + Collection<IASDocTag> tags = source.getTagsByName("param"); + for (IASDocTag ptag : tags) + { + addTag(new ASDocTag(ptag.getName(), ptag.getDescription())); + } + } + } + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler/src/org/apache/flex/compiler/asdoc/IASDocComment.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/asdoc/IASDocComment.java b/compiler/src/org/apache/flex/compiler/asdoc/IASDocComment.java index 72018d2..82a0325 100644 --- a/compiler/src/org/apache/flex/compiler/asdoc/IASDocComment.java +++ b/compiler/src/org/apache/flex/compiler/asdoc/IASDocComment.java @@ -19,6 +19,10 @@ package org.apache.flex.compiler.asdoc; +import java.util.Collection; +import java.util.List; +import java.util.Map; + import org.apache.flex.compiler.definitions.IDocumentableDefinition; import org.apache.flex.compiler.tree.as.IDocumentableDefinitionNode; @@ -30,5 +34,17 @@ import org.apache.flex.compiler.tree.as.IDocumentableDefinitionNode; */ public interface IASDocComment { + String getDescription(); + + void compile(); + + boolean hasTag(String name); + + IASDocTag getTag(String name); + + Map<String, List<IASDocTag>> getTags(); + + Collection<IASDocTag> getTagsByName(String name); + void paste(IASDocComment source); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9981ec5f/compiler/src/org/apache/flex/compiler/asdoc/IASDocTag.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/asdoc/IASDocTag.java b/compiler/src/org/apache/flex/compiler/asdoc/IASDocTag.java new file mode 100644 index 0000000..9e4b4be --- /dev/null +++ b/compiler/src/org/apache/flex/compiler/asdoc/IASDocTag.java @@ -0,0 +1,29 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.asdoc; + +public interface IASDocTag +{ + String getName(); + + String getDescription(); + + boolean hasDescription(); +}
