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

Side by Side Diff: pkg/smoke/lib/static.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« no previous file with comments | « pkg/smoke/lib/src/common.dart ('k') | pkg/smoke/test/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Static implementation of smoke services using code-generated data. 5 /// Static implementation of smoke services using code-generated data.
6 library smoke.static; 6 library smoke.static;
7 7
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:logging/logging.dart'; 10 import 'package:logging/logging.dart';
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // we should wrap `e` as a new exception (what's the best way to let users 107 // we should wrap `e` as a new exception (what's the best way to let users
108 // know about this tentativeError?) 108 // know about this tentativeError?)
109 if (tentativeError != null) print(tentativeError); 109 if (tentativeError != null) print(tentativeError);
110 rethrow; 110 rethrow;
111 } 111 }
112 } 112 }
113 } 113 }
114 114
115 /// Implements [TypeInspectorService] using a static configuration. 115 /// Implements [TypeInspectorService] using a static configuration.
116 class _GeneratedTypeInspectorService implements TypeInspectorService { 116 class _GeneratedTypeInspectorService implements TypeInspectorService {
117 bool isSubclassOf(Type type, Type supertype) {
118 if (type == supertype || supertype == Object) return true;
119 while (type != Object) {
120 var parentType = _configuration.parents[type];
121 if (parentType == supertype) return true;
122 if (parentType == null) {
123 throw new MissingCodeException('superclass of "$type" ($parentType)');
124 }
125 type = parentType;
126 }
127 return false;
128 }
129
117 bool hasGetter(Type type, Symbol name) { 130 bool hasGetter(Type type, Symbol name) {
118 var decl = _findDeclaration(type, name); 131 var decl = _findDeclaration(type, name);
119 // No need to check decl.isProperty because methods are also automatically 132 // No need to check decl.isProperty because methods are also automatically
120 // considered getters (auto-closures). 133 // considered getters (auto-closures).
121 return decl != null && !decl.isStatic; 134 return decl != null && !decl.isStatic;
122 } 135 }
123 136
124 bool hasSetter(Type type, Symbol name) { 137 bool hasSetter(Type type, Symbol name) {
125 var decl = _findDeclaration(type, name); 138 var decl = _findDeclaration(type, name);
126 return decl != null && !decl.isMethod && !decl.isFinal && !decl.isStatic; 139 return decl != null && !decl.isMethod && !decl.isFinal && !decl.isStatic;
(...skipping 21 matching lines...) Expand all
148 return decl; 161 return decl;
149 } 162 }
150 163
151 List<Declaration> query(Type type, QueryOptions options) { 164 List<Declaration> query(Type type, QueryOptions options) {
152 var result; 165 var result;
153 if (options.includeInherited) { 166 if (options.includeInherited) {
154 var superclass = _configuration.parents[type]; 167 var superclass = _configuration.parents[type];
155 if (superclass == null) { 168 if (superclass == null) {
156 throw new MissingCodeException('superclass of "$type"'); 169 throw new MissingCodeException('superclass of "$type"');
157 } 170 }
158 result = (superclass == Object) ? [] : query(superclass, options); 171 result = (superclass == options.includeUpTo) ? []
172 : query(superclass, options);
159 } else { 173 } else {
160 result = []; 174 result = [];
161 } 175 }
162 var map = _configuration.declarations[type]; 176 var map = _configuration.declarations[type];
163 if (map == null) { 177 if (map == null) {
164 throw new MissingCodeException('declarations for $type'); 178 throw new MissingCodeException('declarations for $type');
165 } 179 }
166 for (var decl in map.values) { 180 for (var decl in map.values) {
167 if (!options.includeFields && decl.isField) continue; 181 if (!options.includeFields && decl.isField) continue;
168 if (!options.includeProperties && decl.isProperty) continue; 182 if (!options.includeProperties && decl.isProperty) continue;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (declaration != null) return declaration; 217 if (declaration != null) return declaration;
204 } 218 }
205 var parentType = _configuration.parents[type]; 219 var parentType = _configuration.parents[type];
206 if (parentType == null) { 220 if (parentType == null) {
207 throw new MissingCodeException('superclass of "$type"'); 221 throw new MissingCodeException('superclass of "$type"');
208 } 222 }
209 type = parentType; 223 type = parentType;
210 } 224 }
211 return null; 225 return null;
212 } 226 }
OLDNEW
« no previous file with comments | « pkg/smoke/lib/src/common.dart ('k') | pkg/smoke/test/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698