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

Side by Side Diff: test/_data/only_throw_error/only_throw_error.dart

Issue 2100013005: Linter `0.1.21` (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 4 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
« no previous file with comments | « pubspec.yaml ('k') | test/_data/only_throw_errors/only_throw_errors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:core';
6
7 void throwString() {
8 throw 'hello world!'; // LINT
9 }
10
11 void throwNull() {
12 throw null; // LINT
13 }
14
15 void throwNumber() {
16 throw 7; // LINT
17 }
18
19 void throwObject() {
20 throw new Object(); // LINT
21 }
22
23 void throwError() {
24 throw new Error(); // OK
25 }
26
27 void throwDynamicPrebuiltError() {
28 var error = new Error();
29 throw error; // OK
30 }
31
32 void throwStaticPrebuiltError() {
33 Error error = new Error();
34 throw error; // OK
35 }
36
37 void throwArgumentError() {
38 Error error = new ArgumentError('oh!');
39 throw error; // OK
40 }
41
42 void throwException() {
43 Exception exception = new Exception('oh!');
44 throw exception; // OK
45 }
46
47 void throwStringFromFunction() {
48 throw returnString(); // LINT
49 }
50
51 String returnString() => 'string!';
52
53 void throwExceptionFromFunction() {
54 throw returnException();
55 }
56
57 Exception returnException() => new Exception('oh!');
58
59 // TODO: Even though in the test this does not get linted, it does while
60 // analyzing the SDK code. Find out why.
61 dynamic noSuchMethod(Invocation invocation) {
62 throw new NoSuchMethodError(
63 new Object(),
64 invocation.memberName,
65 invocation.positionalArguments,
66 invocation.namedArguments);
67 }
68
69 class E extends Object with Exception {
70 static throws() {
71 throw new E(); // OK
72 }
73 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/_data/only_throw_errors/only_throw_errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698