mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix chrome evaluator SourceEntriesProcessor — mapping can cover the whole line
This commit is contained in:
+30
-4
@@ -1,7 +1,21 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.jetbrains.debugger.sourcemap;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -161,8 +175,12 @@ public abstract class MappingList {
|
||||
return mappings.get(index);
|
||||
}
|
||||
|
||||
public interface MappingsProcessorInLine {
|
||||
boolean process(@NotNull MappingEntry entry, @Nullable MappingEntry nextEntry);
|
||||
}
|
||||
|
||||
// entries will be processed in this list order
|
||||
public boolean processMappingsInLine(int line, @NotNull Processor<MappingEntry> entryProcessor) {
|
||||
public boolean processMappingsInLine(int line, @NotNull MappingsProcessorInLine entryProcessor) {
|
||||
int low = 0;
|
||||
int high = mappings.size() - 1;
|
||||
while (low <= high) {
|
||||
@@ -176,12 +194,20 @@ public abstract class MappingList {
|
||||
firstIndex--;
|
||||
}
|
||||
|
||||
MappingEntry entry = mappings.get(firstIndex);
|
||||
do {
|
||||
if (!entryProcessor.process(mappings.get(firstIndex))) {
|
||||
MappingEntry nextEntry = ++firstIndex < mappings.size() ? mappings.get(firstIndex) : null;
|
||||
if (nextEntry != null && getLine(nextEntry) != line) {
|
||||
nextEntry = null;
|
||||
}
|
||||
|
||||
if (!entryProcessor.process(entry, nextEntry)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
entry = nextEntry;
|
||||
}
|
||||
while (++firstIndex < mappings.size() && getLine(mappings.get(firstIndex)) == line);
|
||||
while (entry != null);
|
||||
return true;
|
||||
}
|
||||
else if (line > mappingLine) {
|
||||
|
||||
+16
-2
@@ -1,8 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.jetbrains.debugger.sourcemap;
|
||||
|
||||
import com.intellij.openapi.util.NullableLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.Url;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -73,7 +87,7 @@ public class SourceMap {
|
||||
|
||||
public boolean processMappingsInLine(@NotNull List<Url> sourceUrls,
|
||||
int sourceLine,
|
||||
@NotNull Processor<MappingEntry> mappingProcessor,
|
||||
@NotNull MappingList.MappingsProcessorInLine mappingProcessor,
|
||||
@Nullable VirtualFile sourceFile,
|
||||
@Nullable NullableLazyValue<SourceResolver.Resolver> resolver) {
|
||||
MappingList mappings = findMappingList(sourceUrls, sourceFile, resolver);
|
||||
|
||||
Reference in New Issue
Block a user