amazon-states-language-service
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -106,3 +106,2 @@ "use strict"; | ||
// keep track of reached states and unreached states to avoid multiple loops | ||
const unreachedStates = {}; | ||
let reachedStates = {}; | ||
@@ -129,13 +128,5 @@ let hasTerminalState = false; | ||
} | ||
// if the state hasn't been reached in any of the previous iterations | ||
// mark it as unreached | ||
if (!reachedStates[stateName]) { | ||
unreachedStates[stateName] = prop; | ||
} | ||
// mark the value of Next property as reached state | ||
// and delete it from the list of unreached states | ||
if (typeof nextNodeValue === 'string') { | ||
reachedStates[nextNodeValue] = true; | ||
// tslint:disable-next-line no-dynamic-delete | ||
delete unreachedStates[nextNodeValue]; | ||
} | ||
@@ -194,4 +185,2 @@ // Validate Parameters for given state types | ||
reachedStates[name] = true; | ||
// tslint:disable-next-line no-dynamic-delete | ||
delete unreachedStates[name]; | ||
} | ||
@@ -225,5 +214,10 @@ } | ||
} | ||
// loop through the hash map of unreached states and create diagnostics | ||
Object.values(unreachedStates).forEach(statePropNode => { | ||
const { length, offset } = statePropNode.keyNode; | ||
// Create diagnostics for states that weren't referenced by a State, Choice Rule, or Catcher's "Next" field | ||
statesValueNode.properties | ||
.filter(statePropNode => { | ||
const stateName = statePropNode.keyNode.value; | ||
return !reachedStates[stateName]; | ||
}) | ||
.forEach(unreachableStatePropNode => { | ||
const { length, offset } = unreachableStatePropNode.keyNode; | ||
const range = vscode_json_languageservice_1.Range.create(document.positionAt(offset), document.positionAt(offset + length)); | ||
@@ -230,0 +224,0 @@ diagnostics.push(vscode_json_languageservice_1.Diagnostic.create(range, diagnosticStrings_1.MESSAGES.UNREACHABLE_STATE, vscode_json_languageservice_1.DiagnosticSeverity.Error)); |
@@ -15,3 +15,3 @@ { | ||
"license": "MIT", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"publisher": "aws", | ||
@@ -18,0 +18,0 @@ "categories": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253301
3780