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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantInitializerEmitter _initializerEmitter; 9 ConstantInitializerEmitter _initializerEmitter;
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 jsAst.Expression _visit(Constant constant) { 173 jsAst.Expression _visit(Constant constant) {
174 return constant.accept(this); 174 return constant.accept(this);
175 } 175 }
176 176
177 jsAst.Expression _reference(Constant constant) { 177 jsAst.Expression _reference(Constant constant) {
178 return referenceEmitter.generateInInitializationContext(constant); 178 return referenceEmitter.generateInInitializationContext(constant);
179 } 179 }
180 180
181 jsAst.Expression visitFunction(FunctionConstant constant) { 181 jsAst.Expression visitFunction(FunctionConstant constant) {
182 compiler.internalError( 182 compiler.internalError(NO_LOCATION_SPANNABLE,
183 "The function constant does not need specific JS code"); 183 "The function constant does not need specific JS code.");
184 return null; 184 return null;
185 } 185 }
186 186
187 jsAst.Expression visitNull(NullConstant constant) { 187 jsAst.Expression visitNull(NullConstant constant) {
188 return _reference(constant); 188 return _reference(constant);
189 } 189 }
190 190
191 jsAst.Expression visitInt(IntConstant constant) { 191 jsAst.Expression visitInt(IntConstant constant) {
192 return _reference(constant); 192 return _reference(constant);
193 } 193 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } else if (field.name == MapConstant.JS_OBJECT_NAME) { 267 } else if (field.name == MapConstant.JS_OBJECT_NAME) {
268 arguments.add(jsMap()); 268 arguments.add(jsMap());
269 } else if (field.name == MapConstant.KEYS_NAME) { 269 } else if (field.name == MapConstant.KEYS_NAME) {
270 arguments.add(_reference(constant.keys)); 270 arguments.add(_reference(constant.keys));
271 } else if (field.name == MapConstant.PROTO_VALUE) { 271 } else if (field.name == MapConstant.PROTO_VALUE) {
272 assert(constant.protoValue != null); 272 assert(constant.protoValue != null);
273 arguments.add(_reference(constant.protoValue)); 273 arguments.add(_reference(constant.protoValue));
274 } else if (field.name == MapConstant.JS_DATA_NAME) { 274 } else if (field.name == MapConstant.JS_DATA_NAME) {
275 arguments.add(jsGeneralMap()); 275 arguments.add(jsGeneralMap());
276 } else { 276 } else {
277 compiler.internalError( 277 compiler.internalError(field,
278 "Compiler has unexpected field ${field.name} for " 278 "Compiler has unexpected field ${field.name} for "
279 "${className}."); 279 "${className}.");
280 } 280 }
281 emittedArgumentCount++; 281 emittedArgumentCount++;
282 }, 282 },
283 includeSuperAndInjectedMembers: true); 283 includeSuperAndInjectedMembers: true);
284 if ((className == MapConstant.DART_STRING_CLASS && 284 if ((className == MapConstant.DART_STRING_CLASS &&
285 emittedArgumentCount != 3) || 285 emittedArgumentCount != 3) ||
286 (className == MapConstant.DART_PROTO_CLASS && 286 (className == MapConstant.DART_PROTO_CLASS &&
287 emittedArgumentCount != 4) || 287 emittedArgumentCount != 4) ||
288 (className == MapConstant.DART_GENERAL_CLASS && 288 (className == MapConstant.DART_GENERAL_CLASS &&
289 emittedArgumentCount != 1)) { 289 emittedArgumentCount != 1)) {
290 compiler.internalError( 290 compiler.internalError(classElement,
291 "Compiler and ${className} disagree on number of fields."); 291 "Compiler and ${className} disagree on number of fields.");
292 } 292 }
293 293
294 jsAst.Expression value = new jsAst.New( 294 jsAst.Expression value = new jsAst.New(
295 new jsAst.VariableUse(getJsConstructor(classElement)), 295 new jsAst.VariableUse(getJsConstructor(classElement)),
296 arguments); 296 arguments);
297 return maybeAddTypeArguments(constant.type, value); 297 return maybeAddTypeArguments(constant.type, value);
298 } 298 }
299 299
300 JavaScriptBackend get backend => compiler.backend; 300 JavaScriptBackend get backend => compiler.backend;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 .map((DartType type) => 360 .map((DartType type) =>
361 rti.getTypeRepresentationWithHashes(type, (_){})); 361 rti.getTypeRepresentationWithHashes(type, (_){}));
362 jsAst.Expression argumentList = 362 jsAst.Expression argumentList =
363 new jsAst.LiteralString('[${arguments.join(', ')}]'); 363 new jsAst.LiteralString('[${arguments.join(', ')}]');
364 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), 364 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()),
365 [value, argumentList]); 365 [value, argumentList]);
366 } 366 }
367 return value; 367 return value;
368 } 368 }
369 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698