| Index: third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ContextTrackingState.java
|
| diff --git a/third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ContextTrackingState.java b/third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ContextTrackingState.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2e336a2608f6e82eb57138f0a5d3cbe727b1505b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ContextTrackingState.java
|
| @@ -0,0 +1,58 @@
|
| +package org.chromium.devtools.jsdoc.checks;
|
| +
|
| +import com.google.javascript.rhino.Node;
|
| +
|
| +import org.chromium.devtools.jsdoc.ValidatorContext;
|
| +
|
| +import java.util.Deque;
|
| +import java.util.HashMap;
|
| +import java.util.LinkedList;
|
| +import java.util.Map;
|
| +
|
| +public class ContextTrackingState {
|
| + private final ValidatorContext context;
|
| +
|
| + ContextTrackingState(ValidatorContext context) {
|
| + this.context = context;
|
| + }
|
| +
|
| + final Map<String, TypeRecord> typeRecordsByTypeName = new HashMap<>();
|
| + final Deque<TypeRecord> typeRecords = new LinkedList<>();
|
| + final Deque<FunctionRecord> functionRecords = new LinkedList<>();
|
| +
|
| + TypeRecord getCurrentTypeRecord() {
|
| + return typeRecords.peekLast();
|
| + }
|
| +
|
| + FunctionRecord getCurrentFunctionRecord() {
|
| + return functionRecords.peekLast();
|
| + }
|
| +
|
| + ValidatorContext getContext() {
|
| + return context;
|
| + }
|
| +
|
| + Map<String, TypeRecord> getTypeRecordsByTypeName() {
|
| + return typeRecordsByTypeName;
|
| + }
|
| +
|
| + String getNodeText(Node node) {
|
| + return getContext().getNodeText(node);
|
| + }
|
| +
|
| + void pushTypeRecord(TypeRecord record) {
|
| + typeRecords.addLast(record);
|
| + }
|
| +
|
| + void popTypeRecord() {
|
| + typeRecords.removeLast();
|
| + }
|
| +
|
| + void pushFunctionRecord(FunctionRecord record) {
|
| + functionRecords.addLast(record);
|
| + }
|
| +
|
| + void popFunctionRecord() {
|
| + functionRecords.removeLast();
|
| + }
|
| +}
|
|
|