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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/native_emitter.dart

Issue 2939033002: Towards compiling Hello World! (Closed)
Patch Set: Fix parameter ordering Created 3 years, 6 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library dart2js.js_emitter.native_emitter; 5 library dart2js.js_emitter.native_emitter;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common_elements.dart' show CommonElements; 8 import '../common_elements.dart' show CommonElements;
9 import '../elements/types.dart' show DartType, FunctionType; 9 import '../elements/types.dart' show DartType, FunctionType;
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 cls.callStubs.isEmpty && 261 cls.callStubs.isEmpty &&
262 !cls.superclass.isMixinApplication && 262 !cls.superclass.isMixinApplication &&
263 !cls.fields.any(needsAccessor); 263 !cls.fields.any(needsAccessor);
264 } 264 }
265 265
266 void potentiallyConvertDartClosuresToJs(List<jsAst.Statement> statements, 266 void potentiallyConvertDartClosuresToJs(List<jsAst.Statement> statements,
267 FunctionEntity member, List<jsAst.Parameter> stubParameters) { 267 FunctionEntity member, List<jsAst.Parameter> stubParameters) {
268 FunctionEntity converter = _commonElements.closureConverter; 268 FunctionEntity converter = _commonElements.closureConverter;
269 jsAst.Expression closureConverter = 269 jsAst.Expression closureConverter =
270 _emitterTask.staticFunctionAccess(converter); 270 _emitterTask.staticFunctionAccess(converter);
271 _worldBuilder.forEachParameter(member, (DartType type, String name) { 271 _worldBuilder.forEachParameter(member, (DartType type, String name, _) {
272 // If [name] is not in [stubParameters], then the parameter is an optional 272 // If [name] is not in [stubParameters], then the parameter is an optional
273 // parameter that was not provided for this stub. 273 // parameter that was not provided for this stub.
274 for (jsAst.Parameter stubParameter in stubParameters) { 274 for (jsAst.Parameter stubParameter in stubParameters) {
275 if (stubParameter.name == name) { 275 if (stubParameter.name == name) {
276 type = type.unaliased; 276 type = type.unaliased;
277 if (type.isFunctionType) { 277 if (type.isFunctionType) {
278 // The parameter type is a function type either directly or through 278 // The parameter type is a function type either directly or through
279 // typedef(s). 279 // typedef(s).
280 FunctionType functionType = type; 280 FunctionType functionType = type;
281 int arity = functionType.parameterTypes.length; 281 int arity = functionType.parameterTypes.length;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // satisfy a check against [element], in which case an interceptor must be 359 // satisfy a check against [element], in which case an interceptor must be
360 // used. We should also use an interceptor if the check can't be satisfied 360 // used. We should also use an interceptor if the check can't be satisfied
361 // by a native class in case we get a native instance that tries to spoof 361 // by a native class in case we get a native instance that tries to spoof
362 // the type info. i.e the criteria for whether or not to use an interceptor 362 // the type info. i.e the criteria for whether or not to use an interceptor
363 // is whether the receiver can be native, not the type of the test. 363 // is whether the receiver can be native, not the type of the test.
364 ClassEntity cls = element; 364 ClassEntity cls = element;
365 if (_nativeData.isNativeOrExtendsNative(cls)) return true; 365 if (_nativeData.isNativeOrExtendsNative(cls)) return true;
366 return isSupertypeOfNativeClass(element); 366 return isSupertypeOfNativeClass(element);
367 } 367 }
368 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698