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

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

Issue 2625713002: Rename Enqueuer.universe to worldBuilder. (Closed)
Patch Set: Fix. Created 3 years, 11 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 '../common.dart'; 8 import '../common.dart';
9 import '../constants/values.dart' 9 import '../constants/values.dart'
10 show ConstantValue, ConstructedConstantValue, StringConstantValue; 10 show ConstantValue, ConstructedConstantValue, StringConstantValue;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (element is FunctionElement) { 110 if (element is FunctionElement) {
111 _checkFunctionParameters(element); 111 _checkFunctionParameters(element);
112 } 112 }
113 113
114 if (!element.isClass) return; 114 if (!element.isClass) return;
115 115
116 ClassElement classElement = element; 116 ClassElement classElement = element;
117 117
118 // Skip classes that are completely unreachable. This should only happen 118 // Skip classes that are completely unreachable. This should only happen
119 // when all of jsinterop types are unreachable from main. 119 // when all of jsinterop types are unreachable from main.
120 if (!backend.compiler.resolverWorld.isImplemented(classElement)) return; 120 if (!backend.compiler.resolutionWorldBuilder.isImplemented(classElement))
Siggi Cherem (dart-lang) 2017/01/11 23:54:56 we might need to add {} here since it's no longer
Johnni Winther 2017/01/12 12:20:12 Done.
121 return;
121 122
122 if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) { 123 if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) {
123 backend.reporter.reportErrorMessage(classElement, 124 backend.reporter.reportErrorMessage(classElement,
124 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { 125 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, {
125 'cls': classElement.name, 126 'cls': classElement.name,
126 'superclass': classElement.superclass.name 127 'superclass': classElement.superclass.name
127 }); 128 });
128 } 129 }
129 130
130 classElement.forEachMember((ClassElement classElement, Element member) { 131 classElement.forEachMember((ClassElement classElement, Element member) {
(...skipping 28 matching lines...) Expand all
159 _checkFunctionParameters(fn); 160 _checkFunctionParameters(fn);
160 } 161 }
161 } 162 }
162 }); 163 });
163 }); 164 });
164 } 165 }
165 166
166 jsAst.Statement buildJsInteropBootstrap() { 167 jsAst.Statement buildJsInteropBootstrap() {
167 if (!enabledJsInterop) return null; 168 if (!enabledJsInterop) return null;
168 List<jsAst.Statement> statements = <jsAst.Statement>[]; 169 List<jsAst.Statement> statements = <jsAst.Statement>[];
169 backend.compiler.codegenWorld.forEachInvokedName( 170 backend.compiler.codegenWorldBuilder.forEachInvokedName(
170 (String name, Map<Selector, SelectorConstraints> selectors) { 171 (String name, Map<Selector, SelectorConstraints> selectors) {
171 selectors.forEach((Selector selector, SelectorConstraints constraints) { 172 selectors.forEach((Selector selector, SelectorConstraints constraints) {
172 if (selector.isClosureCall) { 173 if (selector.isClosureCall) {
173 // TODO(jacobr): support named arguments. 174 // TODO(jacobr): support named arguments.
174 if (selector.namedArgumentCount > 0) return; 175 if (selector.namedArgumentCount > 0) return;
175 int argumentCount = selector.argumentCount; 176 int argumentCount = selector.argumentCount;
176 var candidateParameterNames = 177 var candidateParameterNames =
177 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 178 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
178 var parameters = new List<String>.generate( 179 var parameters = new List<String>.generate(
179 argumentCount, (i) => candidateParameterNames[i]); 180 argumentCount, (i) => candidateParameterNames[i]);
180 181
181 var name = backend.namer.invocationName(selector); 182 var name = backend.namer.invocationName(selector);
182 statements.add(js.statement( 183 statements.add(js.statement(
183 'Function.prototype.# = function(#) { return this(#) }', 184 'Function.prototype.# = function(#) { return this(#) }',
184 [name, parameters, parameters])); 185 [name, parameters, parameters]));
185 } 186 }
186 }); 187 });
187 }); 188 });
188 return new jsAst.Block(statements); 189 return new jsAst.Block(statements);
189 } 190 }
190 191
191 ResolutionFunctionType buildJsFunctionType() { 192 ResolutionFunctionType buildJsFunctionType() {
192 // TODO(jacobr): consider using codegenWorld.isChecks to determine the 193 // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine th e
193 // range of positional arguments that need to be supported by JavaScript 194 // range of positional arguments that need to be supported by JavaScript
194 // function types. 195 // function types.
195 return new ResolutionFunctionType.synthesized( 196 return new ResolutionFunctionType.synthesized(
196 const ResolutionDynamicType(), 197 const ResolutionDynamicType(),
197 [], 198 [],
198 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType())); 199 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType()));
199 } 200 }
200 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698