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

Side by Side Diff: pkg/compiler/lib/src/warnings.dart

Issue 962603002: Typecheck return with respect to async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Allow return; in generators. Created 5 years, 10 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 4
5 part of dart2js; 5 part of dart2js;
6 6
7 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; 7 const DONT_KNOW_HOW_TO_FIX = "Computer says no!";
8 8
9 /** 9 /**
10 * The messages in this file should meet the following guide lines: 10 * The messages in this file should meet the following guide lines:
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 howToFix: "Try removing the '#{modifier}' modifier.", 2125 howToFix: "Try removing the '#{modifier}' modifier.",
2126 examples: const [""" 2126 examples: const ["""
2127 class A { 2127 class A {
2128 A() async; 2128 A() async;
2129 } 2129 }
2130 main() => new A();""", 2130 main() => new A();""",
2131 2131
2132 """ 2132 """
2133 class A { 2133 class A {
2134 A(); 2134 A();
2135 factory A.a() async* => new A(); 2135 factory A.a() async* {}
2136 } 2136 }
2137 main() => new A.a();"""]); 2137 main() => new A.a();"""]);
2138 2138
2139 static const MessageKind ASYNC_MODIFIER_ON_SETTER = 2139 static const MessageKind ASYNC_MODIFIER_ON_SETTER =
2140 const MessageKind( 2140 const MessageKind(
2141 "The modifier '#{modifier}' is not allowed on setters.", 2141 "The modifier '#{modifier}' is not allowed on setters.",
2142 options: const ['--enable-async'], 2142 options: const ['--enable-async'],
2143 howToFix: "Try removing the '#{modifier}' modifier.", 2143 howToFix: "Try removing the '#{modifier}' modifier.",
2144 examples: const [""" 2144 examples: const ["""
2145 class A { 2145 class A {
(...skipping 23 matching lines...) Expand all
2169 }""", 2169 }""",
2170 """ 2170 """
2171 main() async* { 2171 main() async* {
2172 var yield; 2172 var yield;
2173 }""", 2173 }""",
2174 """ 2174 """
2175 main() sync* { 2175 main() sync* {
2176 var yield; 2176 var yield;
2177 }"""]); 2177 }"""]);
2178 2178
2179 static const MessageKind RETURN_IN_GENERATOR =
2180 const MessageKind(
2181 "'return' with a value is not allowed in a method body using the "
2182 "'#{modifier}' modifier.",
2183 howToFix: "Try removing the value, replacing 'return' with 'yield' "
2184 "or changing the method body modifier.",
2185 examples: const [
2186 """
2187 foo() async* { return 0; }
2188 main() => foo();
2189 """,
2190
2191 """
2192 foo() sync* { return 0; }
2193 main() => foo();
2194 """]);
2195
2179 static const MessageKind NATIVE_NOT_SUPPORTED = const MessageKind( 2196 static const MessageKind NATIVE_NOT_SUPPORTED = const MessageKind(
2180 "'native' modifier is not supported.", 2197 "'native' modifier is not supported.",
2181 howToFix: "Try removing the 'native' implementation or analyzing the " 2198 howToFix: "Try removing the 'native' implementation or analyzing the "
2182 "code with the --allow-native-extensions option.", 2199 "code with the --allow-native-extensions option.",
2183 examples: const [""" 2200 examples: const ["""
2184 main() native "Main"; 2201 main() native "Main";
2185 """]); 2202 """]);
2186 2203
2187 static const MessageKind DART_EXT_NOT_SUPPORTED = const MessageKind( 2204 static const MessageKind DART_EXT_NOT_SUPPORTED = const MessageKind(
2188 "The 'dart-ext' scheme is not supported.", 2205 "The 'dart-ext' scheme is not supported.",
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 static String convertToString(value) { 2459 static String convertToString(value) {
2443 if (value is ErrorToken) { 2460 if (value is ErrorToken) {
2444 // Shouldn't happen. 2461 // Shouldn't happen.
2445 return value.assertionMessage; 2462 return value.assertionMessage;
2446 } else if (value is Token) { 2463 } else if (value is Token) {
2447 value = value.value; 2464 value = value.value;
2448 } 2465 }
2449 return '$value'; 2466 return '$value';
2450 } 2467 }
2451 } 2468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698