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

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: merged, and fix typo in member name 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 * function (uses JS "typeof"). This field is null for all other types.
12 */
13 String typeCheckCode;
14
9 String _jsname; 15 String _jsname;
10 16
11 Member _typeMember; 17 Member _typeMember;
12 18
13 /** Stubs used to call into this method dynamically. Lazy initialized. */ 19 /** Stubs used to call into this method dynamically. Lazy initialized. */
14 Map<String, VarMember> varStubs; 20 Map<String, VarMember> varStubs;
15 21
16 Type(this.name): isTested = false; 22 Type(this.name): isTested = false;
17 23
18 void markUsed() {} 24 void markUsed() {}
(...skipping 23 matching lines...) Expand all
42 // TODO(jmesserly): rename to isDynamic? 48 // TODO(jmesserly): rename to isDynamic?
43 bool get isVar() => false; 49 bool get isVar() => false;
44 bool get isTop() => false; 50 bool get isTop() => false;
45 51
46 bool get isObject() => false; 52 bool get isObject() => false;
47 bool get isString() => false; 53 bool get isString() => false;
48 bool get isBool() => false; 54 bool get isBool() => false;
49 bool get isFunction() => false; 55 bool get isFunction() => false;
50 bool get isList() => false; 56 bool get isList() => false;
51 bool get isNum() => false; 57 bool get isNum() => false;
58 bool get isInt() => false;
59 bool get isDouble() => false;
52 bool get isVoid() => false; 60 bool get isVoid() => false;
53 61
54 // Strangely Dart treats calls on Function much like calls on var. 62 // Strangely Dart treats calls on Function much like calls on var.
55 bool get isVarOrFunction() => isVar || isFunction; 63 bool get isVarOrFunction() => isVar || isFunction;
56 64
57 /** Gets the $call method for a function type. */ 65 /** Gets the $call method for a function type. */
58 MethodMember getCallMethod() => null; 66 MethodMember getCallMethod() => null;
59 67
60 /** These types may not be implemented or extended by user code. */ 68 /** These types may not be implemented or extended by user code. */
61 bool get isClosed() => isString || isBool || isNum || isFunction || isVar; 69 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" 175 * of the language spec. It's implemented in terms of the << "more specific"
168 * operator. The spec is below: 176 * operator. The spec is below:
169 * 177 *
170 * A type T is more specific than a type S, written T << S, if one of the 178 * A type T is more specific than a type S, written T << S, if one of the
171 * following conditions is met: 179 * following conditions is met:
172 * - T is S. 180 * - T is S.
173 * - T is Bottom. 181 * - T is Bottom.
174 * - S is Dynamic. 182 * - S is Dynamic.
175 * - S is a direct supertype of T. 183 * - S is a direct supertype of T.
176 * - T is a type variable and S is the upper bound of T. 184 * - T is a type variable and S is the upper bound of T.

error: old chunk mismatch

OLDNEW

Powered by Google App Engine
This is Rietveld 408576698