forked from jruby/jruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constructor signatures to signature parser
- Loading branch information
Showing
8 changed files
with
627 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/org/jruby/ast/java_signature/ConstructorSignatureNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package org.jruby.ast.java_signature; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* | ||
*/ | ||
public class ConstructorSignatureNode extends SignatureNode { | ||
public ConstructorSignatureNode(String name, List<ParameterNode> parameterList) { | ||
super(name, parameterList); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package org.jruby.ast.java_signature; | ||
|
||
import java.util.List; | ||
|
||
public class SignatureNode { | ||
protected List<Modifier> modifiers; | ||
protected String name; | ||
protected List<ParameterNode> parameterList; | ||
protected String extraTypeInfo; | ||
protected List<TypeNode> throwTypes; | ||
|
||
public SignatureNode(String name, List<ParameterNode> parameterList) { | ||
this.name = name; | ||
this.parameterList = parameterList; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public List<ParameterNode> getParameters() { | ||
return parameterList; | ||
} | ||
|
||
public void setModifiers(List<Modifier> modifiers) { | ||
this.modifiers = modifiers; | ||
} | ||
|
||
public void setExtraTypeInfo(String extraTypeInfo) { | ||
this.extraTypeInfo = extraTypeInfo; | ||
} | ||
|
||
public List<Modifier> getModifiers() { | ||
return modifiers; | ||
} | ||
|
||
public void setThrows(List<TypeNode> throwTypes) { | ||
this.throwTypes = throwTypes; | ||
} | ||
|
||
public List<TypeNode> getThrows() { | ||
return throwTypes; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
|
||
for (Modifier modifier: modifiers) { | ||
builder.append(modifier).append(' '); | ||
} | ||
|
||
if (extraTypeInfo != null) { | ||
builder.append(extraTypeInfo).append(' '); | ||
} | ||
|
||
builder.append(name).append('('); | ||
|
||
int length = parameterList.size(); | ||
for (int i = 0; i < length - 1; i++) { | ||
builder.append(parameterList.get(i)).append(", "); | ||
} | ||
|
||
if (length > 0) builder.append(parameterList.get(length - 1)); | ||
|
||
builder.append(')'); | ||
|
||
length = throwTypes.size(); | ||
if (length > 0) { | ||
builder.append(" throws "); | ||
for (int i = 0; i < length - 1; i++) { | ||
builder.append(throwTypes.get(i)).append(", "); | ||
} | ||
builder.append(throwTypes.get(length - 1)); | ||
} | ||
|
||
return builder.toString(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.