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

Side by Side Diff: pkg/compiler/lib/src/native/ssa.dart

Issue 1408043002: Move native and js interop properties from the element model to the JS backend (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 1 month 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); 7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
8 8
9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { 9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
10 Compiler compiler = builder.compiler; 10 Compiler compiler = builder.compiler;
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 // Check which pattern this native method follows: 30 // Check which pattern this native method follows:
31 // 1) foo() native; 31 // 1) foo() native;
32 // hasBody = false 32 // hasBody = false
33 // 2) foo() native "bar"; 33 // 2) foo() native "bar";
34 // No longer supported, this is now done with @JSName('foo') and case 1. 34 // No longer supported, this is now done with @JSName('foo') and case 1.
35 // 3) foo() native "return 42"; 35 // 3) foo() native "return 42";
36 // hasBody = true 36 // hasBody = true
37 bool hasBody = false; 37 bool hasBody = false;
38 assert(element.isNative); 38 assert(backend.isNative(element));
39 String nativeMethodName = element.fixedBackendName; 39 String nativeMethodName = backend.getFixedBackendName(element);
40 if (nativeBody != null) { 40 if (nativeBody != null) {
41 LiteralString jsCode = nativeBody.asLiteralString(); 41 LiteralString jsCode = nativeBody.asLiteralString();
42 String str = jsCode.dartString.slowToString(); 42 String str = jsCode.dartString.slowToString();
43 if (nativeRedirectionRegExp.hasMatch(str)) { 43 if (nativeRedirectionRegExp.hasMatch(str)) {
44 reporter.internalError( 44 reporter.internalError(
45 nativeBody, "Deprecated syntax, use @JSName('name') instead."); 45 nativeBody, "Deprecated syntax, use @JSName('name') instead.");
46 } 46 }
47 hasBody = true; 47 hasBody = true;
48 } 48 }
49 49
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 LiteralString jsCode = nativeBody.asLiteralString(); 106 LiteralString jsCode = nativeBody.asLiteralString();
107 builder.push(new HForeignCode.statement( 107 builder.push(new HForeignCode.statement(
108 js.js.statementTemplateYielding( 108 js.js.statementTemplateYielding(
109 new js.LiteralStatement(jsCode.dartString.slowToString())), 109 new js.LiteralStatement(jsCode.dartString.slowToString())),
110 <HInstruction>[], 110 <HInstruction>[],
111 new SideEffects(), 111 new SideEffects(),
112 null, 112 null,
113 backend.dynamicType)); 113 backend.dynamicType));
114 } 114 }
115 } 115 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/scanner.dart ('k') | pkg/compiler/lib/src/parser/diet_parser_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698