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

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

Issue 12223036: Always explicitely give a type to HInvokeStatic, and make the literal map know it's a map. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 import 'dart:uri'; 8 import 'dart:uri';
9 import 'dart2jslib.dart' hide SourceString; 9 import 'dart2jslib.dart' hide SourceString;
10 import 'dart_types.dart'; 10 import 'dart_types.dart';
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter; 817 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter;
818 818
819 HInstruction convertDartClosure(Element parameter, FunctionType type) { 819 HInstruction convertDartClosure(Element parameter, FunctionType type) {
820 HInstruction local = builder.localsHandler.readLocal(parameter); 820 HInstruction local = builder.localsHandler.readLocal(parameter);
821 Constant arityConstant = 821 Constant arityConstant =
822 builder.constantSystem.createInt(type.computeArity()); 822 builder.constantSystem.createInt(type.computeArity());
823 HInstruction arity = builder.graph.addConstant(arityConstant); 823 HInstruction arity = builder.graph.addConstant(arityConstant);
824 // TODO(ngeoffray): For static methods, we could pass a method with a 824 // TODO(ngeoffray): For static methods, we could pass a method with a
825 // defined arity. 825 // defined arity.
826 Element helper = builder.backend.getClosureConverter(); 826 Element helper = builder.backend.getClosureConverter();
827 builder.pushInvokeHelper2(helper, local, arity); 827 builder.pushInvokeHelper2(helper, local, arity, HType.UNKNOWN);
828 HInstruction closure = builder.pop(); 828 HInstruction closure = builder.pop();
829 return closure; 829 return closure;
830 } 830 }
831 831
832 // Check which pattern this native method follows: 832 // Check which pattern this native method follows:
833 // 1) foo() native; 833 // 1) foo() native;
834 // hasBody = false 834 // hasBody = false
835 // 2) foo() native "bar"; 835 // 2) foo() native "bar";
836 // No longer supported, this is now done with @JSName('foo') and case 1. 836 // No longer supported, this is now done with @JSName('foo') and case 1.
837 // 3) foo() native "return 42"; 837 // 3) foo() native "return 42";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } else { 893 } else {
894 if (parameters.parameterCount != 0) { 894 if (parameters.parameterCount != 0) {
895 compiler.cancel( 895 compiler.cancel(
896 'native "..." syntax is restricted to functions with zero parameters', 896 'native "..." syntax is restricted to functions with zero parameters',
897 node: nativeBody); 897 node: nativeBody);
898 } 898 }
899 LiteralString jsCode = nativeBody.asLiteralString(); 899 LiteralString jsCode = nativeBody.asLiteralString();
900 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); 900 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[]));
901 } 901 }
902 } 902 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698