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

Side by Side Diff: frog/type.dart

Issue 8457007: Better runtime type checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: cleaner output 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
None
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 class Type implements Named, Hashable { 5 class Type implements Named, Hashable {
6 final String name; 6 final String name;
7 bool isTested; 7 bool isTested;
8 8
9 /**
10 * For core types (int, String, etc) this is the generated type assertion
11 * type check function. It uses JS typeof, and does extra work for "int".
12 * This field is null for all other types.
13 */
14 String typeCheckCode;
15
9 String _jsname; 16 String _jsname;
10 17
11 Member _typeMember; 18 Member _typeMember;
12 19
13 /** Stubs used to call into this method dynamically. Lazy initialized. */ 20 /** Stubs used to call into this method dynamically. Lazy initialized. */
14 Map<String, VarMember> varStubs; 21 Map<String, VarMember> varStubs;
15 22
16 Type(this.name): isTested = false; 23 Type(this.name): isTested = false;
17 24
18 void markUsed() {} 25 void markUsed() {}
(...skipping 23 matching lines...) Expand all
42 // TODO(jmesserly): rename to isDynamic? 49 // TODO(jmesserly): rename to isDynamic?
43 bool get isVar() => false; 50 bool get isVar() => false;
44 bool get isTop() => false; 51 bool get isTop() => false;
45 52
46 bool get isObject() => false; 53 bool get isObject() => false;
47 bool get isString() => false; 54 bool get isString() => false;
48 bool get isBool() => false; 55 bool get isBool() => false;
49 bool get isFunction() => false; 56 bool get isFunction() => false;
50 bool get isList() => false; 57 bool get isList() => false;
51 bool get isNum() => false; 58 bool get isNum() => false;
59 bool get isInt() => false;
60 bool get isIsDouble() => false;
52 bool get isVoid() => false; 61 bool get isVoid() => false;
53 62
54 // Strangely Dart treats calls on Function much like calls on var. 63 // Strangely Dart treats calls on Function much like calls on var.
55 bool get isVarOrFunction() => isVar || isFunction; 64 bool get isVarOrFunction() => isVar || isFunction;
56 65
57 /** Gets the $call method for a function type. */ 66 /** Gets the $call method for a function type. */
58 MethodMember getCallMethod() => null; 67 MethodMember getCallMethod() => null;
59 68
60 /** These types may not be implemented or extended by user code. */ 69 /** These types may not be implemented or extended by user code. */
61 bool get isClosed() => isString || isBool || isNum || isFunction || isVar; 70 bool get isClosed() => isString || isBool || isNum || isFunction || isVar;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 * of the language spec. It's implemented in terms of the << "more specific" 176 * of the language spec. It's implemented in terms of the << "more specific"
168 * operator. The spec is below: 177 * operator. The spec is below:
169 * 178 *
170 * A type T is more specific than a type S, written T << S, if one of the 179 * A type T is more specific than a type S, written T << S, if one of the
171 * following conditions is met: 180 * following conditions is met:
172 * - T is S. 181 * - T is S.
173 * - T is Bottom. 182 * - T is Bottom.
174 * - S is Dynamic. 183 * - S is Dynamic.
175 * - S is a direct supertype of T. 184 * - S is a direct supertype of T.
176 * - T is a type variable and S is the upper bound of T. 185 * - T is a type variable and S is the upper bound of T.

error: old chunk mismatch

OLDNEW
« frog/presubmit.py ('K') | « frog/tokenizer.g.dart ('k') | frog/value.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698