Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10703046: Issue 3753. Support for @deprecated annotation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Analyze for @deprecated all invocable elements Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 package com.google.dart.compiler.type; 4 package com.google.dart.compiler.type;
5 5
6 import com.google.common.base.Joiner; 6 import com.google.common.base.Joiner;
7 import com.google.common.collect.Iterables; 7 import com.google.common.collect.Iterables;
8 import com.google.common.collect.Lists; 8 import com.google.common.collect.Lists;
9 import com.google.common.collect.Maps; 9 import com.google.common.collect.Maps;
10 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; 10 import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 2916
2917 public void test_variableUsedAsType() throws Exception { 2917 public void test_variableUsedAsType() throws Exception {
2918 AnalyzeLibraryResult libraryResult = analyzeLibrary( 2918 AnalyzeLibraryResult libraryResult = analyzeLibrary(
2919 "// filler filler filler filler filler filler filler filler filler fille r", 2919 "// filler filler filler filler filler filler filler filler filler fille r",
2920 "var func;", 2920 "var func;",
2921 "func i;"); 2921 "func i;");
2922 assertErrors( 2922 assertErrors(
2923 libraryResult.getErrors(), 2923 libraryResult.getErrors(),
2924 errEx(TypeErrorCode.NOT_A_TYPE, 3, 1, 4)); 2924 errEx(TypeErrorCode.NOT_A_TYPE, 3, 1, 4));
2925 } 2925 }
2926
2927 public void test_metadata_deprecated_1() throws Exception {
2928 AnalyzeLibraryResult libraryResult = analyzeLibrary(
2929 "// filler filler filler filler filler filler filler filler filler fille r",
2930 "// @deprecated",
2931 "ttt() {}",
2932 "class A {",
2933 " // @deprecated",
2934 " var fff;",
2935 " // @deprecated",
2936 " mmmm() {}",
2937 " // @deprecated",
2938 " operator + (other) {}",
2939 "}",
2940 "main() {",
2941 " ttt();",
2942 " A a = new A();",
2943 " a.fff = 0;",
2944 " a.mmmm();",
2945 " a + 0;",
2946 "}",
2947 "");
2948 assertErrors(
2949 libraryResult.getErrors(),
2950 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 13, 3, 3),
2951 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 15, 5, 3),
2952 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 16, 5, 4),
2953 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 17, 5, 1));
2954 }
2955
2956 public void test_metadata_deprecated_2() throws Exception {
2957 AnalyzeLibraryResult libraryResult = analyzeLibrary(
2958 "// filler filler filler filler filler filler filler filler filler fille r",
2959 "// @deprecated",
2960 "class A {",
2961 " A.named() {}",
2962 " // @deprecated",
2963 " A.depreca() {}",
2964 "}",
2965 "main() {",
2966 " new A.named();",
2967 " new A.depreca();",
2968 "}",
2969 "");
2970 assertErrors(
2971 libraryResult.getErrors(),
2972 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 9, 7, 1),
2973 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 10, 7, 1),
2974 errEx(TypeErrorCode.DEPRECATED_ELEMENT, 10, 9, 7));
2975 }
2926 2976
2927 public void test_assignMethod() throws Exception { 2977 public void test_assignMethod() throws Exception {
2928 AnalyzeLibraryResult libraryResult = analyzeLibrary( 2978 AnalyzeLibraryResult libraryResult = analyzeLibrary(
2929 "// filler filler filler filler filler filler filler filler filler fille r", 2979 "// filler filler filler filler filler filler filler filler filler fille r",
2930 "class C {" + 2980 "class C {" +
2931 " method() { }", 2981 " method() { }",
2932 "}", 2982 "}",
2933 "main () {", 2983 "main () {",
2934 " new C().method = _() {};", 2984 " new C().method = _() {};",
2935 "}"); 2985 "}");
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 && index < sourceInfo.getEnd() 3049 && index < sourceInfo.getEnd()
3000 && clazz.isInstance(node)) { 3050 && clazz.isInstance(node)) {
3001 result.set((T) node); 3051 result.set((T) node);
3002 } 3052 }
3003 return super.visitNode(node); 3053 return super.visitNode(node);
3004 } 3054 }
3005 }); 3055 });
3006 return result.get(); 3056 return result.get();
3007 } 3057 }
3008 } 3058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698