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

Side by Side Diff: pkg/compiler/lib/src/js_backend/js_interop_analysis.dart

Issue 1457383003: Alternative fix for the js-interop crash. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/native/behavior.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) 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 '../common/names.dart' show Identifiers; 8 import '../common/names.dart' show Identifiers;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../diagnostics/messages.dart' show MessageKind; 10 import '../diagnostics/messages.dart' show MessageKind;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 processJsInteropAnnotation(element); 113 processJsInteropAnnotation(element);
114 if (!backend.isJsInterop(element)) return; 114 if (!backend.isJsInterop(element)) return;
115 if (element is FunctionElement) { 115 if (element is FunctionElement) {
116 _checkFunctionParameters(element); 116 _checkFunctionParameters(element);
117 } 117 }
118 118
119 if (!element.isClass) return; 119 if (!element.isClass) return;
120 120
121 ClassElement classElement = element; 121 ClassElement classElement = element;
122 122
123 // Skip classes that are completely unreachable. This should only happen
124 // when all of jsinterop types are unreachable from main.
125 if (!backend.compiler.world.isImplemented(classElement)) return;
126
123 if (!classElement 127 if (!classElement
124 .implementsInterface(helpers.jsJavaScriptObjectClass)) { 128 .implementsInterface(helpers.jsJavaScriptObjectClass)) {
125 backend.reporter.reportErrorMessage(classElement, 129 backend.reporter.reportErrorMessage(classElement,
126 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { 130 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, {
127 'cls': classElement.name, 131 'cls': classElement.name,
128 'superclass': classElement.superclass.name 132 'superclass': classElement.superclass.name
129 }); 133 });
130 } 134 }
131 135
132 classElement.forEachMember( 136 classElement.forEachMember(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 var name = backend.namer.invocationName(selector); 188 var name = backend.namer.invocationName(selector);
185 statements.add(js.statement( 189 statements.add(js.statement(
186 'Function.prototype.# = function(#) { return this(#) }', 190 'Function.prototype.# = function(#) { return this(#) }',
187 [name, parameters, parameters])); 191 [name, parameters, parameters]));
188 } 192 }
189 }); 193 });
190 }); 194 });
191 return new jsAst.Block(statements); 195 return new jsAst.Block(statements);
192 } 196 }
193 } 197 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/native/behavior.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698