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

Side by Side Diff: lib/corelib.dart

Issue 8343037: Throw FallThroughError when we fall through a case in a switch statement. Fixes (Closed) Base URL: http://dart.googlecode.com/svn/experimental/frog/
Patch Set: '' Created 9 years, 1 month 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 #library("dart:core"); 5 #library("dart:core");
6 #import("dart:coreimpl"); 6 #import("dart:coreimpl");
7 7
8 #native("core.js"); 8 #native("core.js");
9 9
10 // TODO(jimhug): Better way to map in standard corelib 10 // TODO(jimhug): Better way to map in standard corelib
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 String toString() { 85 String toString() {
86 return "Failed type check: type $srcType is not assignable to type " + 86 return "Failed type check: type $srcType is not assignable to type " +
87 "$dstType of $dstName in $url at line " + 87 "$dstType of $dstName in $url at line " +
88 "$line, column $column."; 88 "$line, column $column.";
89 } 89 }
90 final String srcType; 90 final String srcType;
91 final String dstType; 91 final String dstType;
92 final String dstName; 92 final String dstName;
93 } 93 }
94 class FallThroughError { 94 class FallThroughError {
95 const FallThroughError() : super(); 95 final String url;
96 final int line;
97
98 const FallThroughError(this.url, this.line);
99
100 String toString() {
101 return "Switch case fall-through in $url at line $line.";
102 }
96 } 103 }
97 104
98 // Dart core library. 105 // Dart core library.
99 106
100 class Object native "Object" { 107 class Object native "Object" {
101 108
102 const Object() native; 109 const Object() native;
103 110
104 bool operator ==(Object other) native; 111 bool operator ==(Object other) native;
105 String toString() native; 112 String toString() native;
106 113
107 // TODO(jmesserly): optimize this. No need to call it. 114 // TODO(jmesserly): optimize this. No need to call it.
108 get dynamic() => this; 115 get dynamic() => this;
109 116
110 // TODO(jmesserly): add named args. For now stay compatible with the VM. 117 // TODO(jmesserly): add named args. For now stay compatible with the VM.
111 void noSuchMethod(String name, List args) { 118 void noSuchMethod(String name, List args) {
112 throw new NoSuchMethodException(this, name, args); 119 throw new NoSuchMethodException(this, name, args);
113 } 120 }
114 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698