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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/metadata_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class MetadataEmitter extends CodeEmitterHelper { 7 class MetadataEmitter extends CodeEmitterHelper {
8 /// A list of JS expressions that represent metadata, parameter names and 8 /// A list of JS expressions that represent metadata, parameter names and
9 /// type, and return types. 9 /// type, and return types.
10 final List<String> globalMetadata = []; 10 final List<String> globalMetadata = [];
(...skipping 11 matching lines...) Expand all
22 if (!backend.retainMetadataOf(element)) return null; 22 if (!backend.retainMetadataOf(element)) return null;
23 return compiler.withCurrentElement(element, () { 23 return compiler.withCurrentElement(element, () {
24 var metadata = []; 24 var metadata = [];
25 Link link = element.metadata; 25 Link link = element.metadata;
26 // TODO(ahe): Why is metadata sometimes null? 26 // TODO(ahe): Why is metadata sometimes null?
27 if (link != null) { 27 if (link != null) {
28 for (; !link.isEmpty; link = link.tail) { 28 for (; !link.isEmpty; link = link.tail) {
29 MetadataAnnotation annotation = link.head; 29 MetadataAnnotation annotation = link.head;
30 Constant value = annotation.value; 30 Constant value = annotation.value;
31 if (value == null) { 31 if (value == null) {
32 compiler.reportInternalError(annotation, 32 compiler.internalError(annotation, 'Annotation value is null.');
33 MessageKind.GENERIC, {'text': 'Annotation value is null'});
34 } else { 33 } else {
35 metadata.add(task.constantReference(value)); 34 metadata.add(task.constantReference(value));
36 } 35 }
37 } 36 }
38 } 37 }
39 if (metadata.isEmpty) return null; 38 if (metadata.isEmpty) return null;
40 return js.fun( 39 return js.fun(
41 [], [js.return_(new jsAst.ArrayInitializer.from(metadata))]); 40 [], [js.return_(new jsAst.ArrayInitializer.from(metadata))]);
42 }); 41 });
43 } 42 }
(...skipping 10 matching lines...) Expand all
54 : jsAst.prettyPrint(task.constantReference(value), compiler) 53 : jsAst.prettyPrint(task.constantReference(value), compiler)
55 .getText(); 54 .getText();
56 defaultValues.add(addGlobalMetadata(stringRepresentation)); 55 defaultValues.add(addGlobalMetadata(stringRepresentation));
57 } 56 }
58 return defaultValues; 57 return defaultValues;
59 } 58 }
60 59
61 int reifyMetadata(MetadataAnnotation annotation) { 60 int reifyMetadata(MetadataAnnotation annotation) {
62 Constant value = annotation.value; 61 Constant value = annotation.value;
63 if (value == null) { 62 if (value == null) {
64 compiler.reportInternalError(annotation, 63 compiler.internalError(annotation, 'Annotation value is null.');
65 MessageKind.GENERIC, {'text': 'Annotation value is null'});
66 return -1; 64 return -1;
67 } 65 }
68 return addGlobalMetadata( 66 return addGlobalMetadata(
69 jsAst.prettyPrint(task.constantReference(value), compiler).getText()); 67 jsAst.prettyPrint(task.constantReference(value), compiler).getText());
70 } 68 }
71 69
72 int reifyType(DartType type) { 70 int reifyType(DartType type) {
73 jsAst.Expression representation = 71 jsAst.Expression representation =
74 backend.rti.getTypeRepresentation(type, (variable) { 72 backend.rti.getTypeRepresentation(type, (variable) {
75 return js.toExpression( 73 return js.toExpression(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // TODO(ahe): Why is metadata sometimes null? 124 // TODO(ahe): Why is metadata sometimes null?
127 if (link != null) { 125 if (link != null) {
128 for (; !link.isEmpty; link = link.tail) { 126 for (; !link.isEmpty; link = link.tail) {
129 metadata.add(reifyMetadata(link.head)); 127 metadata.add(reifyMetadata(link.head));
130 } 128 }
131 } 129 }
132 return metadata; 130 return metadata;
133 }); 131 });
134 } 132 }
135 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698