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

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

Issue 2721403006: Split NativeData (Closed)
Patch Set: Updated cf. comments. Created 3 years, 9 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
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 import '../common.dart'; 5 import '../common.dart';
6 import '../compiler.dart' show Compiler; 6 import '../compiler.dart' show Compiler;
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../elements/resolution_types.dart'; 8 import '../elements/resolution_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../js/js.dart' as js; 10 import '../js/js.dart' as js;
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 // Check which pattern this native method follows: 42 // Check which pattern this native method follows:
43 // 1) foo() native; 43 // 1) foo() native;
44 // hasBody = false 44 // hasBody = false
45 // 2) foo() native "bar"; 45 // 2) foo() native "bar";
46 // No longer supported, this is now done with @JSName('foo') and case 1. 46 // No longer supported, this is now done with @JSName('foo') and case 1.
47 // 3) foo() native "return 42"; 47 // 3) foo() native "return 42";
48 // hasBody = true 48 // hasBody = true
49 bool hasBody = false; 49 bool hasBody = false;
50 assert(backend.isNative(element)); 50 assert(backend.nativeData.isNativeMember(element));
51 String nativeMethodName = backend.nativeData.getFixedBackendName(element); 51 String nativeMethodName = backend.nativeData.getFixedBackendName(element);
52 if (nativeBody != null) { 52 if (nativeBody != null) {
53 LiteralString jsCode = nativeBody.asLiteralString(); 53 LiteralString jsCode = nativeBody.asLiteralString();
54 String str = jsCode.dartString.slowToString(); 54 String str = jsCode.dartString.slowToString();
55 if (nativeRedirectionRegExp.hasMatch(str)) { 55 if (nativeRedirectionRegExp.hasMatch(str)) {
56 reporter.internalError( 56 reporter.internalError(
57 nativeBody, "Deprecated syntax, use @JSName('name') instead."); 57 nativeBody, "Deprecated syntax, use @JSName('name') instead.");
58 } 58 }
59 hasBody = true; 59 hasBody = true;
60 } 60 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 LiteralString jsCode = nativeBody.asLiteralString(); 119 LiteralString jsCode = nativeBody.asLiteralString();
120 builder.push(new HForeignCode.statement( 120 builder.push(new HForeignCode.statement(
121 js.js.statementTemplateYielding( 121 js.js.statementTemplateYielding(
122 new js.LiteralStatement(jsCode.dartString.slowToString())), 122 new js.LiteralStatement(jsCode.dartString.slowToString())),
123 <HInstruction>[], 123 <HInstruction>[],
124 new SideEffects(), 124 new SideEffects(),
125 null, 125 null,
126 builder.commonMasks.dynamicType)); 126 builder.commonMasks.dynamicType));
127 } 127 }
128 } 128 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/null_compiler_output.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698