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

Side by Side Diff: lib/compiler/implementation/native_handler.dart

Issue 10091048: Fix remaining warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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('native'); 5 #library('native');
6 #import('dart:uri'); 6 #import('dart:uri');
7 #import('leg.dart'); 7 #import('leg.dart');
8 #import('elements/elements.dart'); 8 #import('elements/elements.dart');
9 #import('scanner/scannerlib.dart'); 9 #import('scanner/scannerlib.dart');
10 #import('ssa/ssa.dart'); 10 #import('ssa/ssa.dart');
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 element.setNative(); 197 element.setNative();
198 NativeEmitter nativeEmitter = compiler.emitter.nativeEmitter; 198 NativeEmitter nativeEmitter = compiler.emitter.nativeEmitter;
199 // If what we're compiling is a getter named 'typeName' and the native 199 // If what we're compiling is a getter named 'typeName' and the native
200 // class is named 'DOMType', we generate a call to the typeNameOf 200 // class is named 'DOMType', we generate a call to the typeNameOf
201 // function attached on the isolate. 201 // function attached on the isolate.
202 // The DOM classes assume that their 'typeName' property, which is 202 // The DOM classes assume that their 'typeName' property, which is
203 // not a JS property on the DOM types, returns the type name. 203 // not a JS property on the DOM types, returns the type name.
204 if (element.name == const SourceString('typeName') 204 if (element.name == const SourceString('typeName')
205 && element.isGetter() 205 && element.isGetter()
206 && nativeEmitter.toNativeName(element.enclosingElement) == 'DOMType') { 206 && nativeEmitter.toNativeName(element.enclosingElement) == 'DOMType') {
207 Element element = compiler.findHelper(const SourceString('getTypeNameOf')); 207 Element methodElement =
208 HStatic method = new HStatic(element); 208 compiler.findHelper(const SourceString('getTypeNameOf'));
209 HStatic method = new HStatic(methodElement);
209 builder.add(method); 210 builder.add(method);
210 builder.push(new HInvokeStatic(Selector.INVOCATION_1, 211 builder.push(new HInvokeStatic(Selector.INVOCATION_1,
211 <HInstruction>[method, builder.localsHandler.readThis()])); 212 <HInstruction>[method, builder.localsHandler.readThis()]));
212 return; 213 return;
213 } 214 }
214 215
215 HInstruction convertDartClosure(Element parameter) { 216 HInstruction convertDartClosure(Element parameter) {
216 HInstruction local = builder.localsHandler.readLocal(parameter); 217 HInstruction local = builder.localsHandler.readLocal(parameter);
217 // TODO(ngeoffray): by better analyzing the function type and 218 // TODO(ngeoffray): by better analyzing the function type and
218 // its formal parameters, we could pass a method with a defined arity. 219 // its formal parameters, we could pass a method with a defined arity.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 306 }
306 307
307 void generateMethodWithPrototypeCheckForElement(Compiler compiler, 308 void generateMethodWithPrototypeCheckForElement(Compiler compiler,
308 StringBuffer buffer, 309 StringBuffer buffer,
309 FunctionElement element, 310 FunctionElement element,
310 String code, 311 String code,
311 String parameters) { 312 String parameters) {
312 String methodName; 313 String methodName;
313 Namer namer = compiler.namer; 314 Namer namer = compiler.namer;
314 if (element.kind == ElementKind.FUNCTION) { 315 if (element.kind == ElementKind.FUNCTION) {
315 FunctionParameters parameters = element.computeParameters(compiler); 316 FunctionParameters computedParameters =
317 element.computeParameters(compiler);
316 methodName = namer.instanceMethodName( 318 methodName = namer.instanceMethodName(
317 element.getLibrary(), element.name, parameters.parameterCount); 319 element.getLibrary(), element.name, computedParameters.parameterCount);
318 } else if (element.kind == ElementKind.GETTER) { 320 } else if (element.kind == ElementKind.GETTER) {
319 methodName = namer.getterName(element.getLibrary(), element.name); 321 methodName = namer.getterName(element.getLibrary(), element.name);
320 } else if (element.kind == ElementKind.SETTER) { 322 } else if (element.kind == ElementKind.SETTER) {
321 methodName = namer.setterName(element.getLibrary(), element.name); 323 methodName = namer.setterName(element.getLibrary(), element.name);
322 } else { 324 } else {
323 compiler.internalError('unexpected kind: "${element.kind}"', 325 compiler.internalError('unexpected kind: "${element.kind}"',
324 element: element); 326 element: element);
325 } 327 }
326 328
327 generateMethodWithPrototypeCheck( 329 generateMethodWithPrototypeCheck(
(...skipping 13 matching lines...) Expand all
341 String parameters) { 343 String parameters) {
342 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); 344 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty");
343 buffer.add("('$methodName')) {\n"); 345 buffer.add("('$methodName')) {\n");
344 buffer.add(" $code"); 346 buffer.add(" $code");
345 buffer.add(" } else {\n"); 347 buffer.add(" } else {\n");
346 buffer.add(" return Object.prototype.$methodName.call(this"); 348 buffer.add(" return Object.prototype.$methodName.call(this");
347 buffer.add(parameters == '' ? '' : ', $parameters'); 349 buffer.add(parameters == '' ? '' : ', $parameters');
348 buffer.add(");\n"); 350 buffer.add(");\n");
349 buffer.add(" }\n"); 351 buffer.add(" }\n");
350 } 352 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/native_emitter.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698