typing cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4105 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
b7f3f8b7a8
commit
032f82f713
|
@ -24,7 +24,6 @@ import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
|
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
|
||||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
|
||||||
import com.ibm.wala.cast.tree.impl.LineNumberPosition;
|
import com.ibm.wala.cast.tree.impl.LineNumberPosition;
|
||||||
import com.ibm.wala.util.functions.Function;
|
import com.ibm.wala.util.functions.Function;
|
||||||
|
|
||||||
|
@ -55,14 +54,14 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
||||||
this.entrypointRegion = new SourceRegion();
|
this.entrypointRegion = new SourceRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Function<Integer,Position> makePos(int lineNumber, ITag governingTag) {
|
protected Function<Integer,IncludedPosition> makePos(int lineNumber, ITag governingTag) {
|
||||||
return makePos(entrypointUrl, lineNumber, governingTag);
|
return makePos(entrypointUrl, lineNumber, governingTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Function<Integer,Position> makePos(final URL url, final int lineNumber, ITag governingTag) {
|
protected Function<Integer,IncludedPosition> makePos(final URL url, final int lineNumber, ITag governingTag) {
|
||||||
final LineNumberPosition includePos = new LineNumberPosition(entrypointUrl, entrypointUrl, governingTag.getStartingLineNum());
|
final LineNumberPosition includePos = new LineNumberPosition(entrypointUrl, entrypointUrl, governingTag.getStartingLineNum());
|
||||||
return new Function<Integer,Position>() {
|
return new Function<Integer,IncludedPosition>() {
|
||||||
public Position apply(Integer object) {
|
public IncludedPosition apply(Integer object) {
|
||||||
return new IncludedLineNumberPosition(url, url, lineNumber + object.intValue(), includePos);
|
return new IncludedLineNumberPosition(url, url, lineNumber + object.intValue(), includePos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,13 +22,13 @@ import com.ibm.wala.util.collections.HashMapFactory;
|
||||||
* Maps line numbers to lines of other files (fileName + line).
|
* Maps line numbers to lines of other files (fileName + line).
|
||||||
*/
|
*/
|
||||||
public class FileMapping{
|
public class FileMapping{
|
||||||
protected Map<Integer, Position> lineNumberToFileAndLine = HashMapFactory.make();
|
protected Map<Integer, IncludedPosition> lineNumberToFileAndLine = HashMapFactory.make();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param line
|
* @param line
|
||||||
* @return Null if no mapping for the given line.
|
* @return Null if no mapping for the given line.
|
||||||
*/
|
*/
|
||||||
public Position getAssociatedFileAndLine(int line){
|
public IncludedPosition getAssociatedFileAndLine(int line){
|
||||||
return lineNumberToFileAndLine.get(line);
|
return lineNumberToFileAndLine.get(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,9 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package com.ibm.wala.cast.js.html;
|
package com.ibm.wala.cast.js.html;
|
||||||
|
|
||||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
|
||||||
|
|
||||||
public class MutableFileMapping extends FileMapping {
|
public class MutableFileMapping extends FileMapping {
|
||||||
|
|
||||||
void map(int line, Position originalPos){
|
void map(int line, IncludedPosition originalPos){
|
||||||
lineNumberToFileAndLine.put(line, originalPos);
|
lineNumberToFileAndLine.put(line, originalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class SourceRegion {
|
||||||
public SourceRegion() {
|
public SourceRegion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void print(String text, Function<Integer,Position> originalPos){
|
public void print(String text, Function<Integer,IncludedPosition> originalPos){
|
||||||
source.append(text);
|
source.append(text);
|
||||||
int ln = 0;
|
int ln = 0;
|
||||||
int numberOfLineDrops = getNumberOfLineDrops(text);
|
int numberOfLineDrops = getNumberOfLineDrops(text);
|
||||||
|
@ -44,7 +44,7 @@ public class SourceRegion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void println(String text, Function<Integer,Position> originalPos){
|
public void println(String text, Function<Integer,IncludedPosition> originalPos){
|
||||||
print(text + "\n", originalPos);
|
print(text + "\n", originalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class SourceRegion {
|
||||||
while ((line = br.readLine()) != null){
|
while ((line = br.readLine()) != null){
|
||||||
lineNum++;
|
lineNum++;
|
||||||
|
|
||||||
Position fileAndLine = otherRegion.fileMapping.getAssociatedFileAndLine(lineNum);
|
IncludedPosition fileAndLine = otherRegion.fileMapping.getAssociatedFileAndLine(lineNum);
|
||||||
if (fileAndLine!= null){
|
if (fileAndLine!= null){
|
||||||
fileMapping.map(currentLine, fileAndLine);
|
fileMapping.map(currentLine, fileAndLine);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AbstractEntity implements CAstEntity {
|
||||||
return sourcePosition;
|
return sourcePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<?> getScopedEntities(CAstNode construct) {
|
public Iterator<CAstEntity> getScopedEntities(CAstNode construct) {
|
||||||
if (scopedEntities.containsKey(construct)) {
|
if (scopedEntities.containsKey(construct)) {
|
||||||
return scopedEntities.get(construct).iterator();
|
return scopedEntities.get(construct).iterator();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -139,7 +139,7 @@ public interface CAstEntity {
|
||||||
* Enclosed entities not induced by a specific AST node are mapped
|
* Enclosed entities not induced by a specific AST node are mapped
|
||||||
* by the construct 'null'.
|
* by the construct 'null'.
|
||||||
*/
|
*/
|
||||||
Iterator getScopedEntities(CAstNode construct);
|
Iterator<CAstEntity> getScopedEntities(CAstNode construct);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CAPA AST of this entity.
|
* The CAPA AST of this entity.
|
||||||
|
@ -171,7 +171,7 @@ public interface CAstEntity {
|
||||||
* Returns an Iterator over the qualifiers of the given entity, if it has
|
* Returns an Iterator over the qualifiers of the given entity, if it has
|
||||||
* any, e.g., "final", "private".
|
* any, e.g., "final", "private".
|
||||||
*/
|
*/
|
||||||
Collection/*<CAstQualifier>*/ getQualifiers();
|
Collection<CAstQualifier> getQualifiers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CAst type of this entity.
|
* The CAst type of this entity.
|
||||||
|
|
Loading…
Reference in New Issue