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

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

Issue 11453032: Reapply class/method/field minification (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback Created 8 years 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:uri'; 7 import 'dart:uri';
8 import 'dart2jslib.dart' hide SourceString; 8 import 'dart2jslib.dart' hide SourceString;
9 import 'elements/elements.dart'; 9 import 'elements/elements.dart';
10 import 'js_backend/js_backend.dart'; 10 import 'js_backend/js_backend.dart';
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 // TODO(ngeoffray): For static methods, we could pass a method with a 816 // TODO(ngeoffray): For static methods, we could pass a method with a
817 // defined arity. 817 // defined arity.
818 Element helper = builder.interceptors.getClosureConverter(); 818 Element helper = builder.interceptors.getClosureConverter();
819 builder.pushInvokeHelper2(helper, local, arity); 819 builder.pushInvokeHelper2(helper, local, arity);
820 HInstruction closure = builder.pop(); 820 HInstruction closure = builder.pop();
821 return closure; 821 return closure;
822 } 822 }
823 823
824 // Check which pattern this native method follows: 824 // Check which pattern this native method follows:
825 // 1) foo() native; 825 // 1) foo() native;
826 // hasBody = false, isRedirecting = false 826 // hasBody = false
827 // 2) foo() native "bar"; 827 // 2) foo() native "bar";
828 // hasBody = false, isRedirecting = true, no longer supported. 828 // No longer supported, this is now done with @JSName('foo') and case 1.
829 // 3) foo() native "return 42"; 829 // 3) foo() native "return 42";
830 // hasBody = true, isRedirecting = false 830 // hasBody = true
831 bool hasBody = false; 831 bool hasBody = false;
832 assert(element.isNative()); 832 assert(element.isNative());
833 String nativeMethodName = element.nativeName(); 833 String nativeMethodName = element.nativeName();
834 if (nativeBody != null) { 834 if (nativeBody != null) {
835 LiteralString jsCode = nativeBody.asLiteralString(); 835 LiteralString jsCode = nativeBody.asLiteralString();
836 String str = jsCode.dartString.slowToString(); 836 String str = jsCode.dartString.slowToString();
837 if (nativeRedirectionRegExp.hasMatch(str)) { 837 if (nativeRedirectionRegExp.hasMatch(str)) {
838 compiler.cancel("Deprecated syntax, use @JSName('name') instead.", 838 compiler.cancel("Deprecated syntax, use @JSName('name') instead.",
839 node: nativeBody); 839 node: nativeBody);
840 } 840 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 builder.add(new HForeign( 901 builder.add(new HForeign(
902 new DartString.literal('${parameter.name.slowToString()} = #'), 902 new DartString.literal('${parameter.name.slowToString()} = #'),
903 const LiteralDartString('void'), 903 const LiteralDartString('void'),
904 <HInstruction>[jsClosure])); 904 <HInstruction>[jsClosure]));
905 } 905 }
906 }); 906 });
907 LiteralString jsCode = nativeBody.asLiteralString(); 907 LiteralString jsCode = nativeBody.asLiteralString();
908 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); 908 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[]));
909 } 909 }
910 } 910 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698