Chromium Code Reviews

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 part of js_backend; 5 part of js_backend;
6 6
7 class NativeEmitter { 7 class NativeEmitter {
8 8
9 CodeEmitterTask emitter; 9 CodeEmitterTask emitter;
10 CodeBuffer nativeBuffer; 10 CodeBuffer nativeBuffer;
(...skipping 209 matching lines...)
220 // calling conventions. 220 // calling conventions.
221 target = backend.namer.getName(member); 221 target = backend.namer.getName(member);
222 arguments = argumentsBuffer; 222 arguments = argumentsBuffer;
223 } else { 223 } else {
224 // When calling a JS method, we call it with the native name, and only the 224 // When calling a JS method, we call it with the native name, and only the
225 // arguments up until the last one provided. 225 // arguments up until the last one provided.
226 target = member.fixedBackendName(); 226 target = member.fixedBackendName();
227 227
228 if (isInterceptedMethod) { 228 if (isInterceptedMethod) {
229 receiver = argumentsBuffer[0]; 229 receiver = argumentsBuffer[0];
230 arguments = argumentsBuffer.getRange(1, 230 arguments = argumentsBuffer.sublist(1,
231 indexOfLastOptionalArgumentInParameters); 231 indexOfLastOptionalArgumentInParameters + 1);
232 } else { 232 } else {
233 receiver = new jsAst.VariableUse('this'); 233 receiver = new jsAst.VariableUse('this');
234 arguments = argumentsBuffer.getRange(0, 234 arguments = argumentsBuffer.sublist(0,
235 indexOfLastOptionalArgumentInParameters + 1); 235 indexOfLastOptionalArgumentInParameters + 1);
236 } 236 }
237 } 237 }
238 statements.add(new jsAst.Return(receiver[target](arguments))); 238 statements.add(new jsAst.Return(receiver[target](arguments)));
239 239
240 if (!overriddenMethods.contains(member)) { 240 if (!overriddenMethods.contains(member)) {
241 // Call the method directly. 241 // Call the method directly.
242 return statements; 242 return statements;
243 } else { 243 } else {
244 return <jsAst.Statement>[ 244 return <jsAst.Statement>[
(...skipping 301 matching lines...)
546 if (emitter.compiler.enableMinification) targetBuffer.add(';'); 546 if (emitter.compiler.enableMinification) targetBuffer.add(';');
547 targetBuffer.add(jsAst.prettyPrint( 547 targetBuffer.add(jsAst.prettyPrint(
548 new jsAst.ExpressionStatement(init), compiler)); 548 new jsAst.ExpressionStatement(init), compiler));
549 targetBuffer.add('\n'); 549 targetBuffer.add('\n');
550 } 550 }
551 551
552 targetBuffer.add(nativeBuffer); 552 targetBuffer.add(nativeBuffer);
553 targetBuffer.add('\n'); 553 targetBuffer.add('\n');
554 } 554 }
555 } 555 }
OLDNEW

Powered by Google App Engine