| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1dc08f6 commit 71b8e5f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1144,7 +1144,7 @@ private void handleSketchProblems(PreprocessedSketch ps) { | |||
| 1144 | 1144 | static private JavaProblem convertIProblem(IProblem iproblem, PreprocessedSketch ps) { | |
| 1145 | 1145 | SketchInterval in = ps.mapJavaToSketch(iproblem); | |
| 1146 | 1146 | if (in == SketchInterval.BEFORE_START) return null; | |
| 1147 | - String badCode = ps.pdeCode.substring(in.startPdeOffset, in.stopPdeOffset); | ||
| 1147 | + String badCode = ps.getPdeCode(in); | ||
| 1148 | 1148 | int line = ps.tabOffsetToTabLine(in.tabIndex, in.startTabOffset); | |
| 1149 | 1149 | JavaProblem p = JavaProblem.fromIProblem(iproblem, in.tabIndex, line, badCode); | |
| 1150 | 1150 | p.setPDEOffsets(in.startTabOffset, in.stopTabOffset); | |
@@ -1213,7 +1213,7 @@ static private List<JavaProblem> checkForCurlyQuotes(PreprocessedSketch ps) { | |||
| 1213 | 1213 | case IProblem.UnterminatedString: | |
| 1214 | 1214 | SketchInterval in = ps.mapJavaToSketch(iproblem); | |
| 1215 | 1215 | if (in == SketchInterval.BEFORE_START) continue; | |
| 1216 | - String badCode = ps.pdeCode.substring(in.startPdeOffset, in.stopPdeOffset); | ||
| 1216 | + String badCode = ps.getPdeCode(in); | ||
| 1217 | 1217 | matcher.reset(badCode); | |
| 1218 | 1218 | while (matcher.find()) { | |
| 1219 | 1219 | int offset = matcher.start(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,6 +77,14 @@ public boolean inRange(SketchInterval interval) { | |||
| 77 | 77 | } | |
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | + public String getPdeCode(SketchInterval si) { | ||
| 81 | + if (si == SketchInterval.BEFORE_START) return ""; | ||
| 82 | + int stop = Math.min(si.stopPdeOffset, pdeCode.length()); | ||
| 83 | + int start = Math.min(si.startPdeOffset, stop); | ||
| 84 | + return pdeCode.substring(start, stop); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + | ||
| 80 | 88 | public SketchInterval mapJavaToSketch(ASTNode node) { | |
| 81 | 89 | return mapJavaToSketch(node.getStartPosition(), | |
| 82 | 90 | node.getStartPosition() + node.getLength()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments