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: pkg/compiler/lib/src/js_backend/js_interop_analysis.dart

Issue 1809533004: Support serialization of WorldImpact (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Analysis to determine how to generate code for typed JavaScript interop. 5 /// Analysis to determine how to generate code for typed JavaScript interop.
6 library compiler.src.js_backend.js_interop_analysis; 6 library compiler.src.js_backend.js_interop_analysis;
7 7
8 import '../diagnostics/messages.dart' show MessageKind; 8 import '../diagnostics/messages.dart' show MessageKind;
9 import '../constants/values.dart' 9 import '../constants/values.dart'
10 show 10 show
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void processJsInteropAnnotation(Element e) { 63 void processJsInteropAnnotation(Element e) {
64 for (MetadataAnnotation annotation in e.implementation.metadata) { 64 for (MetadataAnnotation annotation in e.implementation.metadata) {
65 ConstantValue constant = backend.compiler.constants.getConstantValue( 65 ConstantValue constant = backend.compiler.constants.getConstantValue(
66 annotation.constant); 66 annotation.constant);
67 if (constant == null || constant is! ConstructedConstantValue) continue; 67 if (constant == null || constant is! ConstructedConstantValue) continue;
68 ConstructedConstantValue constructedConstant = constant; 68 ConstructedConstantValue constructedConstant = constant;
69 if (constructedConstant.type.element == helpers.jsAnnotationClass) { 69 if (constructedConstant.type.element == helpers.jsAnnotationClass) {
70 ConstantValue value = constructedConstant.fields[nameField]; 70 ConstantValue value = constructedConstant.fields[nameField];
71 if (value.isString) { 71 if (value.isString) {
72 StringConstantValue stringValue = value; 72 StringConstantValue stringValue = value;
73 backend.setJsInteropName( 73 backend.nativeData.setJsInteropName(
74 e, stringValue.primitiveValue.slowToString()); 74 e, stringValue.primitiveValue.slowToString());
75 } else { 75 } else {
76 // TODO(jacobr): report a warning if the value is not a String. 76 // TODO(jacobr): report a warning if the value is not a String.
77 backend.setJsInteropName(e, ''); 77 backend.nativeData.setJsInteropName(e, '');
78 } 78 }
79 enabledJsInterop = true; 79 enabledJsInterop = true;
80 return; 80 return;
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85 bool hasAnonymousAnnotation(Element element) { 85 bool hasAnonymousAnnotation(Element element) {
86 if (backend.helpers.jsAnonymousClass == null) return false; 86 if (backend.helpers.jsAnonymousClass == null) return false;
87 return element.metadata.any((MetadataAnnotation annotation) { 87 return element.metadata.any((MetadataAnnotation annotation) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 var name = backend.namer.invocationName(selector); 186 var name = backend.namer.invocationName(selector);
187 statements.add(js.statement( 187 statements.add(js.statement(
188 'Function.prototype.# = function(#) { return this(#) }', 188 'Function.prototype.# = function(#) { return this(#) }',
189 [name, parameters, parameters])); 189 [name, parameters, parameters]));
190 } 190 }
191 }); 191 });
192 }); 192 });
193 return new jsAst.Block(statements); 193 return new jsAst.Block(statements);
194 } 194 }
195 } 195 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_backend.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698