Example #1
0
 /**
  * Tells if <code>this</code> is of the stated <code>JSOM</code> type.
  *
  * @param pType  One of the <code>JSOMType.???</code> constants defined by
  *               the interface <code>JSOM</code>.
  *
  * @return  <code>true</code> if <code>this</code> is of the stated <code>
  *          JSOM</code> type.
  */
 public bool isJSOMType(JSOMType pType)
 {
     return mJSOMType == pType;
 }
 /**
  * Constructor.
  *
  * @param pTree  The tree node representing any method or constructor
  *               declaration. Note that it's up to derived classes to check
  *               that the given tree node is of a valid type.
  * @param pJSOMType  One of the <code>JSOMType.???</code> constants defined
  *                   by the interface <code>JSOM</code>.
  * @param pTokenRewriteStream  The token stream the token of the stated
  *                             tree node belongs to.
  */
 protected AST2CommonMethodOrConstructorDeclaration(AST2JSOMTree pTree, JSOMType pJSOMType, TokenRewriteStream pTokenRewriteStream)
     : base(pTree, pJSOMType, pTokenRewriteStream)
 {
     // All types of method or constructor declarations start with a modifier
     // list (that may be empty).
     mModifierListTree = (AST2JSOMTree)pTree.GetChild(0);
     // Then there may follow a generic type parameter list.
     int childOffset = 1;
     AST2JSOMTree child = (AST2JSOMTree)pTree.GetChild(childOffset);
     if (child.Type == JavaTreeParser.GENERIC_TYPE_PARAM_LIST) {
     mGenericTypeParamTree = child;
     childOffset++;
     child = (AST2JSOMTree)pTree.GetChild(childOffset);
     }
     // Get the formal parameter list.
     while (child.Type != JavaTreeParser.FORMAL_PARAM_LIST) {
     childOffset++;
     child = (AST2JSOMTree)pTree.GetChild(childOffset);
     }
     if (child.ChildCount > 0) {
     mParamsTree = child;
     }
     // Finally check if there is a 'throws' clause
     childOffset++;
     int numberOfChildren = pTree.ChildCount;
     while (childOffset < numberOfChildren) {
     child = (AST2JSOMTree)pTree.GetChild(childOffset);
     if (child.Type == JavaTreeParser.THROWS_CLAUSE) {
         mThrowsClauseTree = child;
         break;
     }
     childOffset++;
     }
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param pTree  The ANTLR tree node wrapped by the new object.
  * @param pJSOMType  One of the <code>JSOMType.???</code> constants defined
  *                   by the interface <code>JSOM</code>.
  * @param pTokenRewriteStream  The token stream the token of the stated
  *                             tree node belongs to.
  */
 protected AST2JSOM(
     AST2JSOMTree pTree, JSOMType? pJSOMType, 
     TokenRewriteStream pTokenRewriteStream)
 {
     mTree = pTree;
     mJSOMType = pJSOMType;
     mTokenRewriteStream = pTokenRewriteStream;
 }