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

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

Issue 1485823004: Merge CL for js-interop crash fix. 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 processJsInteropAnnotation(element); 109 processJsInteropAnnotation(element);
110 if (!element.isJsInterop) return; 110 if (!element.isJsInterop) return;
111 if (element is FunctionElement) { 111 if (element is FunctionElement) {
112 _checkFunctionParameters(element); 112 _checkFunctionParameters(element);
113 } 113 }
114 114
115 if (!element.isClass) return; 115 if (!element.isClass) return;
116 116
117 ClassElement classElement = element; 117 ClassElement classElement = element;
118 118
119 // Skip classes that are completely unreachable. This should only happen
120 // when all of jsinterop types are unreachable from main.
121 if (!backend.compiler.world.isImplemented(classElement)) return;
122
119 if (!classElement 123 if (!classElement
120 .implementsInterface(backend.jsJavaScriptObjectClass)) { 124 .implementsInterface(backend.jsJavaScriptObjectClass)) {
121 backend.reporter.reportErrorMessage(classElement, 125 backend.reporter.reportErrorMessage(classElement,
122 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { 126 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, {
123 'cls': classElement.name, 127 'cls': classElement.name,
124 'superclass': classElement.superclass.name 128 'superclass': classElement.superclass.name
125 }); 129 });
126 } 130 }
127 131
128 classElement.forEachMember( 132 classElement.forEachMember(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 var name = backend.namer.invocationName(selector); 184 var name = backend.namer.invocationName(selector);
181 statements.add(js.statement( 185 statements.add(js.statement(
182 'Function.prototype.# = function(#) { return this(#) }', 186 'Function.prototype.# = function(#) { return this(#) }',
183 [name, parameters, parameters])); 187 [name, parameters, parameters]));
184 } 188 }
185 }); 189 });
186 }); 190 });
187 return new jsAst.Block(statements); 191 return new jsAst.Block(statements);
188 } 192 }
189 } 193 }
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