View | Details | Raw Unified | Return to bug 324840 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 82-89 Link Here
82
}
82
}
83
83
84
public StringBuffer printStatement(int tab, StringBuffer output) {
84
public StringBuffer printStatement(int tab, StringBuffer output) {
85
	printIndent(tab, output).append("break "); //$NON-NLS-1$
85
	printIndent(tab, output).append("break"); //$NON-NLS-1$
86
	if (this.label != null) output.append(this.label);
86
	if (this.label != null) output.append(' ').append(this.label);
87
	return output.append(';');
87
	return output.append(';');
88
}
88
}
89
89
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 53-64 Link Here
53
public StringBuffer printStatement(int tab, StringBuffer output) {
53
public StringBuffer printStatement(int tab, StringBuffer output) {
54
	printIndent(tab, output);
54
	printIndent(tab, output);
55
	if (this.constantExpression == null) {
55
	if (this.constantExpression == null) {
56
		output.append("default : "); //$NON-NLS-1$
56
		output.append("default :"); //$NON-NLS-1$
57
	} else {
57
	} else {
58
		output.append("case "); //$NON-NLS-1$
58
		output.append("case "); //$NON-NLS-1$
59
		this.constantExpression.printExpression(0, output).append(" : "); //$NON-NLS-1$
59
		this.constantExpression.printExpression(0, output).append(" :"); //$NON-NLS-1$
60
	}
60
	}
61
	return output.append(';');
61
	return output;
62
}
62
}
63
63
64
/**
64
/**
(-)compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java (-22 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 30-47 Link Here
30
	this(token, s,e);
30
	this(token, s,e);
31
	this.value = value;
31
	this.value = value;
32
}
32
}
33
34
public IntLiteral(int intValue) {
35
	//special optimized constructor : the cst is the argument
36
	//value that should not be used
37
	//	tokens = null ;
38
	//	sourceStart = 0;
39
	//	sourceEnd = 0;
40
	super(null,0,0);
41
	this.constant = IntConstant.fromValue(intValue);
42
	this.value = intValue;
43
}
44
45
public void computeConstant() {
33
public void computeConstant() {
46
	//a special constant is use for the potential Integer.MAX_VALUE+1
34
	//a special constant is use for the potential Integer.MAX_VALUE+1
47
	//which is legal if used with a - as prefix....cool....
35
	//which is legal if used with a - as prefix....cool....
Lines 133-147 Link Here
133
			(this.source[9] == '8') &&
121
			(this.source[9] == '8') &&
134
			(((this.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0));
122
			(((this.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0));
135
}
123
}
136
137
public StringBuffer printExpression(int indent, StringBuffer output){
138
	if (this.source == null) {
139
	/* special optimized IntLiteral that are created by the compiler */
140
		return output.append(String.valueOf(this.value));
141
	}
142
	return super.printExpression(indent, output);
143
}
144
145
public void traverse(ASTVisitor visitor, BlockScope scope) {
124
public void traverse(ASTVisitor visitor, BlockScope scope) {
146
	visitor.visit(this, scope);
125
	visitor.visit(this, scope);
147
	visitor.endVisit(this, scope);
126
	visitor.endVisit(this, scope);
(-)src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java (-6 / +6 lines)
Lines 7863-7869 Link Here
7863
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
7863
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
7864
	String expectedParentNodeToString =
7864
	String expectedParentNodeToString =
7865
			"switch (1) {\n" +
7865
			"switch (1) {\n" +
7866
			"case <CompleteOnName:zzz> : ;\n" +
7866
			"case <CompleteOnName:zzz> :\n" +
7867
			"}";
7867
			"}";
7868
	String completionIdentifier = "zzz";
7868
	String completionIdentifier = "zzz";
7869
	String expectedReplacedSource = "zzz";
7869
	String expectedReplacedSource = "zzz";
Lines 7874-7880 Link Here
7874
			"  void foo() {\n" +
7874
			"  void foo() {\n" +
7875
			"    {\n" +
7875
			"    {\n" +
7876
			"      switch (1) {\n" +
7876
			"      switch (1) {\n" +
7877
			"      case <CompleteOnName:zzz> : ;\n" +
7877
			"      case <CompleteOnName:zzz> :\n" +
7878
			"      }\n" +
7878
			"      }\n" +
7879
			"    }\n" +
7879
			"    }\n" +
7880
			"  }\n" +
7880
			"  }\n" +
Lines 7943-7950 Link Here
7943
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
7943
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
7944
	String expectedParentNodeToString =
7944
	String expectedParentNodeToString =
7945
			"switch (1) {\n" +
7945
			"switch (1) {\n" +
7946
			"case Something : ;\n" +
7946
			"case Something :\n" +
7947
			"case <CompleteOnName:zzz> : ;\n" +
7947
			"case <CompleteOnName:zzz> :\n" +
7948
			"}";
7948
			"}";
7949
	String completionIdentifier = "zzz";
7949
	String completionIdentifier = "zzz";
7950
	String expectedReplacedSource = "zzz";
7950
	String expectedReplacedSource = "zzz";
Lines 7955-7962 Link Here
7955
			"  void foo() {\n" +
7955
			"  void foo() {\n" +
7956
			"    {\n" +
7956
			"    {\n" +
7957
			"      switch (1) {\n" +
7957
			"      switch (1) {\n" +
7958
			"      case Something : ;\n" +
7958
			"      case Something :\n" +
7959
			"      case <CompleteOnName:zzz> : ;\n" +
7959
			"      case <CompleteOnName:zzz> :\n" +
7960
			"      }\n" +
7960
			"      }\n" +
7961
			"    }\n" +
7961
			"    }\n" +
7962
			"  }\n" +
7962
			"  }\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/EnumCompletionParserTest.java (-30 / +30 lines)
Lines 116-122 Link Here
116
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
116
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
117
	expectedParentNodeToString =
117
	expectedParentNodeToString =
118
		"switch (c) {\n" +
118
		"switch (c) {\n" +
119
		"case <CompleteOnName:FOO> : ;\n" +
119
		"case <CompleteOnName:FOO> :\n" +
120
		"}";
120
		"}";
121
	completionIdentifier = "FOO";
121
	completionIdentifier = "FOO";
122
	expectedReplacedSource = "FOO";
122
	expectedReplacedSource = "FOO";
Lines 127-133 Link Here
127
		"  void foo() {\n" +
127
		"  void foo() {\n" +
128
		"    {\n" +
128
		"    {\n" +
129
		"      switch (c) {\n" +
129
		"      switch (c) {\n" +
130
		"      case <CompleteOnName:FOO> : ;\n" +
130
		"      case <CompleteOnName:FOO> :\n" +
131
		"      }\n" +
131
		"      }\n" +
132
		"    }\n" +
132
		"    }\n" +
133
		"  }\n" +
133
		"  }\n" +
Lines 183-190 Link Here
183
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
183
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
184
	expectedParentNodeToString =
184
	expectedParentNodeToString =
185
		"switch (c) {\n" +
185
		"switch (c) {\n" +
186
		"case BAR : ;\n" +
186
		"case BAR :\n" +
187
		"case <CompleteOnName:FOO> : ;\n" +
187
		"case <CompleteOnName:FOO> :\n" +
188
		"}";
188
		"}";
189
	completionIdentifier = "FOO";
189
	completionIdentifier = "FOO";
190
	expectedReplacedSource = "FOO";
190
	expectedReplacedSource = "FOO";
Lines 195-202 Link Here
195
		"  void foo() {\n" +
195
		"  void foo() {\n" +
196
		"    {\n" +
196
		"    {\n" +
197
		"      switch (c) {\n" +
197
		"      switch (c) {\n" +
198
		"      case BAR : ;\n" +
198
		"      case BAR :\n" +
199
		"      case <CompleteOnName:FOO> : ;\n" +
199
		"      case <CompleteOnName:FOO> :\n" +
200
		"      }\n" +
200
		"      }\n" +
201
		"    }\n" +
201
		"    }\n" +
202
		"  }\n" +
202
		"  }\n" +
Lines 253-261 Link Here
253
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
253
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
254
	expectedParentNodeToString =
254
	expectedParentNodeToString =
255
		"switch (c) {\n" +
255
		"switch (c) {\n" +
256
		"case BAR : ;\n" +
256
		"case BAR :\n" +
257
		"    break ;\n" +
257
		"    break;\n" +
258
		"case <CompleteOnName:FOO> : ;\n" +
258
		"case <CompleteOnName:FOO> :\n" +
259
		"}";
259
		"}";
260
	completionIdentifier = "FOO";
260
	completionIdentifier = "FOO";
261
	expectedReplacedSource = "FOO";
261
	expectedReplacedSource = "FOO";
Lines 266-274 Link Here
266
		"  void foo() {\n" +
266
		"  void foo() {\n" +
267
		"    {\n" +
267
		"    {\n" +
268
		"      switch (c) {\n" +
268
		"      switch (c) {\n" +
269
		"      case BAR : ;\n" +
269
		"      case BAR :\n" +
270
		"          break ;\n" +
270
		"          break;\n" +
271
		"      case <CompleteOnName:FOO> : ;\n" +
271
		"      case <CompleteOnName:FOO> :\n" +
272
		"      }\n" +
272
		"      }\n" +
273
		"    }\n" +
273
		"    }\n" +
274
		"  }\n" +
274
		"  }\n" +
Lines 324-332 Link Here
324
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
324
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
325
	expectedParentNodeToString =
325
	expectedParentNodeToString =
326
		"switch (c) {\n" +
326
		"switch (c) {\n" +
327
		"case BAR : ;\n" +
327
		"case BAR :\n" +
328
		"    break ;\n" +
328
		"    break;\n" +
329
		"case <CompleteOnName:FOO> : ;\n" +
329
		"case <CompleteOnName:FOO> :\n" +
330
		"}";
330
		"}";
331
	completionIdentifier = "FOO";
331
	completionIdentifier = "FOO";
332
	expectedReplacedSource = "FOO";
332
	expectedReplacedSource = "FOO";
Lines 337-345 Link Here
337
		"  void foo() {\n" +
337
		"  void foo() {\n" +
338
		"    {\n" +
338
		"    {\n" +
339
		"      switch (c) {\n" +
339
		"      switch (c) {\n" +
340
		"      case BAR : ;\n" +
340
		"      case BAR :\n" +
341
		"          break ;\n" +
341
		"          break;\n" +
342
		"      case <CompleteOnName:FOO> : ;\n" +
342
		"      case <CompleteOnName:FOO> :\n" +
343
		"      }\n" +
343
		"      }\n" +
344
		"    }\n" +
344
		"    }\n" +
345
		"  }\n" +
345
		"  }\n" +
Lines 395-403 Link Here
395
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
395
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
396
	expectedParentNodeToString =
396
	expectedParentNodeToString =
397
		"switch (c) {\n" +
397
		"switch (c) {\n" +
398
		"case BAR : ;\n" +
398
		"case BAR :\n" +
399
		"    break ;\n" +
399
		"    break;\n" +
400
		"case <CompleteOnName:FOO> : ;\n" +
400
		"case <CompleteOnName:FOO> :\n" +
401
		"}";
401
		"}";
402
	completionIdentifier = "FOO";
402
	completionIdentifier = "FOO";
403
	expectedReplacedSource = "FOO";
403
	expectedReplacedSource = "FOO";
Lines 408-416 Link Here
408
		"  void foo() {\n" +
408
		"  void foo() {\n" +
409
		"    {\n" +
409
		"    {\n" +
410
		"      switch (c) {\n" +
410
		"      switch (c) {\n" +
411
		"      case BAR : ;\n" +
411
		"      case BAR :\n" +
412
		"          break ;\n" +
412
		"          break;\n" +
413
		"      case <CompleteOnName:FOO> : ;\n" +
413
		"      case <CompleteOnName:FOO> :\n" +
414
		"      }\n" +
414
		"      }\n" +
415
		"    }\n" +
415
		"    }\n" +
416
		"  }\n" +
416
		"  }\n" +
Lines 472-480 Link Here
472
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
472
	expectedCompletionNodeToString = "<CompleteOnName:FOO>";
473
	expectedParentNodeToString =
473
	expectedParentNodeToString =
474
		"switch (c) {\n" +
474
		"switch (c) {\n" +
475
		"case BAR : ;\n" +
475
		"case BAR :\n" +
476
		"    break ;\n" +
476
		"    break;\n" +
477
		"case <CompleteOnName:FOO> : ;\n" +
477
		"case <CompleteOnName:FOO> :\n" +
478
		"}";
478
		"}";
479
	completionIdentifier = "FOO";
479
	completionIdentifier = "FOO";
480
	expectedReplacedSource = "FOO";
480
	expectedReplacedSource = "FOO";
Lines 486-494 Link Here
486
		"    {\n" +
486
		"    {\n" +
487
		"      {\n" +
487
		"      {\n" +
488
		"        switch (c) {\n" +
488
		"        switch (c) {\n" +
489
		"        case BAR : ;\n" +
489
		"        case BAR :\n" +
490
		"            break ;\n" +
490
		"            break;\n" +
491
		"        case <CompleteOnName:FOO> : ;\n" +
491
		"        case <CompleteOnName:FOO> :\n" +
492
		"        }\n" +
492
		"        }\n" +
493
		"      }\n" +
493
		"      }\n" +
494
		"    }\n" +
494
		"    }\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/EnumSelectionTest.java (-1 / +1 lines)
Lines 39-45 Link Here
39
		"  void foo() {\n" +
39
		"  void foo() {\n" +
40
		"    {\n" +
40
		"    {\n" +
41
		"      switch (e) {\n" +
41
		"      switch (e) {\n" +
42
		"      case <SelectOnName:A> : ;\n" +
42
		"      case <SelectOnName:A> :\n" +
43
		"      }\n" +
43
		"      }\n" +
44
		"    }\n" +
44
		"    }\n" +
45
		"  }\n" +
45
		"  }\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java (-1 / +1 lines)
Lines 2095-2101 Link Here
2095
		"    int i;\n" +
2095
		"    int i;\n" +
2096
		"    {\n" +
2096
		"    {\n" +
2097
		"      switch (i) {\n" +
2097
		"      switch (i) {\n" +
2098
		"      case <CompleteOnMemberAccess:fred().x> : ;\n" +
2098
		"      case <CompleteOnMemberAccess:fred().x> :\n" +
2099
		"      }\n" +
2099
		"      }\n" +
2100
		"    }\n" +
2100
		"    }\n" +
2101
		"  }\n" +
2101
		"  }\n" +

Return to bug 324840