Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 427836
Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.client.javascript/web/javascript/occurrences.js (+6 lines)
Lines 144-149 Link Here
144
					break;
144
					break;
145
				case Estraverse.Syntax.NewExpression:
145
				case Estraverse.Syntax.NewExpression:
146
					this.checkId(node.callee, false);
146
					this.checkId(node.callee, false);
147
					if(node.arguments) {
148
						var len = node.arguments.length;
149
						for(var m = 0; m < len; m++) {
150
							this.checkId(node.arguments[m]);
151
						}
152
					}
147
					break;
153
					break;
148
				case Estraverse.Syntax.LogicalExpression:
154
				case Estraverse.Syntax.LogicalExpression:
149
					this.checkId(node.left);
155
					this.checkId(node.left);
(-)a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/occurrencesTests.js (+96 lines)
Lines 916-920 Link Here
916
			}
916
			}
917
		});
917
		});
918
	};
918
	};
919
	
920
	/**
921
	 * Tests logic expressions that contain identifier nodes
922
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
923
	 */
924
	Tests.test_newExpression1 = function() {
925
		editorContext.text = "var foo = 1;function f1() {};var bar = new f1(foo);";
926
		return occurrences.computeOccurrences(editorContext, setContext(6, 6)).then(function(results) {
927
			try {
928
				assertOccurrences(results, [{start:4, end:7}, {start:46, end:49}]);
929
			}
930
			finally {
931
				tearDown();
932
			}
933
		});
934
	};
935
	
936
	/**
937
	 * Tests logic expressions that contain identifier nodes
938
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
939
	 */
940
	Tests.test_newExpression2 = function() {
941
		editorContext.text = "var foo = 1;function f1() {};var bar = new f1(foo);";
942
		return occurrences.computeOccurrences(editorContext, setContext(48, 48)).then(function(results) {
943
			try {
944
				assertOccurrences(results, [{start:4, end:7}, {start:46, end:49}]);
945
			}
946
			finally {
947
				tearDown();
948
			}
949
		});
950
	};
951
	
952
	/**
953
	 * Tests logic expressions that contain identifier nodes
954
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
955
	 */
956
	Tests.test_newExpression3 = function() {
957
		editorContext.text = "var foo = 1;function f1() {};var o = {a: function() {var bar = new f1(foo);}}";
958
		return occurrences.computeOccurrences(editorContext, setContext(6, 6)).then(function(results) {
959
			try {
960
				assertOccurrences(results, [{start:4, end:7}, {start:70, end:73}]);
961
			}
962
			finally {
963
				tearDown();
964
			}
965
		});
966
	};
967
	
968
	/**
969
	 * Tests logic expressions that contain identifier nodes
970
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
971
	 */
972
	Tests.test_newExpression4 = function() {
973
		editorContext.text = "var foo = 1;function f1() {};var o = {a: function() {var bar = new f1(foo);}}";
974
		return occurrences.computeOccurrences(editorContext, setContext(72, 72)).then(function(results) {
975
			try {
976
				assertOccurrences(results, [{start:4, end:7}, {start:70, end:73}]);
977
			}
978
			finally {
979
				tearDown();
980
			}
981
		});
982
	};
983
	
984
	/**
985
	 * Tests logic expressions that contain identifier nodes
986
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
987
	 */
988
	Tests.test_newExpression5 = function() {
989
		editorContext.text = "var foo = 1;function f1() {};function f2() {var bar = new f1(foo);}";
990
		return occurrences.computeOccurrences(editorContext, setContext(6, 6)).then(function(results) {
991
			try {
992
				assertOccurrences(results, [{start:4, end:7}, {start:61, end:64}]);
993
			}
994
			finally {
995
				tearDown();
996
			}
997
		});
998
	};
999
	
1000
	/**
1001
	 * Tests logic expressions that contain identifier nodes
1002
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427836
1003
	 */
1004
	Tests.test_newExpression6 = function() {
1005
		editorContext.text = "var foo = 1;function f1() {};function f2() {var bar = new f1(foo);}";
1006
		return occurrences.computeOccurrences(editorContext, setContext(62, 62)).then(function(results) {
1007
			try {
1008
				assertOccurrences(results, [{start:4, end:7}, {start:61, end:64}]);
1009
			}
1010
			finally {
1011
				tearDown();
1012
			}
1013
		});
1014
	};
919
	return Tests;
1015
	return Tests;
920
});
1016
});

Return to bug 427836