From 9b15176381c6e2e6b7761c9b803b314e9f1b0fd7 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Wed, 3 Dec 2014 16:52:38 +0200 Subject: textanalysis: ret.state was not always defined Found by investigating a ReferenceError warning: ReferenceError: reference to undefined property --- src/textanalysis.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/textanalysis.js') diff --git a/src/textanalysis.js b/src/textanalysis.js index 1f3d2cd6..269b5785 100644 --- a/src/textanalysis.js +++ b/src/textanalysis.js @@ -12,6 +12,7 @@ var lastnode; var sugg = {}; // suggestions for autocompletion of node names var ANALYSIS_NODE_START = 'ANALYSIS_NODE_START'; +var ANALYSIS_NODE = 'ANALYSIS_NODE' var ANALYSIS_LINK = 'ANALYSIS_LINK'; function selectedType() @@ -179,9 +180,8 @@ var textAnalyser = function (newtext, finalize) { yell_bug = false, // TODO: fix both issues NODE = "NODE", LINK = "LINK", - START = "START"; - - var ret = model_diff.new_topo_diff(); + START = "START", + ret = model_diff.new_topo_diff(); function addNode(name, type, state) { if (type === undefined) { @@ -352,6 +352,7 @@ var textAnalyser = function (newtext, finalize) { addLink(token_set_new_node_names[nodeindex - 1], token_set_new_node_names[nodeindex], token_set_new_link_names[linkindex], typesetter); and_connect(token_set_new_node_names[nodeindex]); } + ret.state = ANALYSIS_NODE_START; break; case LINK: linkindex++; @@ -493,6 +494,7 @@ return { textAnalyser:textAnalyser, autoSuggestAddName:autoSuggestAddName, ANALYSIS_NODE_START:ANALYSIS_NODE_START, + ANALYSIS_NODE: ANALYSIS_NODE, ANALYSIS_LINK:ANALYSIS_LINK, //for the external arrow-type changer -- cgit v1.3.1