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

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

Issue 20224003: Implement IsolateMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 3737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3748 if (buffer != null) { 3748 if (buffer != null) {
3749 var metadata = buildMetadataFunction(library); 3749 var metadata = buildMetadataFunction(library);
3750 mainBuffer 3750 mainBuffer
3751 ..write('["${library.getLibraryOrScriptName()}",$_') 3751 ..write('["${library.getLibraryOrScriptName()}",$_')
3752 ..write('"${uri}",$_') 3752 ..write('"${uri}",$_')
3753 ..write(metadata == null 3753 ..write(metadata == null
3754 ? "" : jsAst.prettyPrint(metadata, compiler)) 3754 ? "" : jsAst.prettyPrint(metadata, compiler))
3755 ..write(',$_') 3755 ..write(',$_')
3756 ..write('{$n') 3756 ..write('{$n')
3757 ..addBuffer(buffer) 3757 ..addBuffer(buffer)
3758 ..write('}],$n'); 3758 ..write('}');
3759 if (library == compiler.mainApp) {
3760 mainBuffer.write(',${n}1');
3761 }
3762 mainBuffer.write('],$n');
3759 } 3763 }
3760 buffer = buffers[1]; 3764 buffer = buffers[1];
3761 if (buffer != null) { 3765 if (buffer != null) {
3762 deferredLibraries 3766 deferredLibraries
3763 ..write('["${library.getLibraryOrScriptName()}",$_') 3767 ..write('["${library.getLibraryOrScriptName()}",$_')
3764 ..write('"${uri}",$_') 3768 ..write('"${uri}",$_')
3765 ..write('[],$_') 3769 ..write('[],$_')
3766 ..write('{$n') 3770 ..write('{$n')
3767 ..addBuffer(buffer) 3771 ..addBuffer(buffer)
3768 ..write('}],$n'); 3772 ..write('}],$n');
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3969 var mangledNames = init.mangledNames; 3973 var mangledNames = init.mangledNames;
3970 var mangledGlobalNames = init.mangledGlobalNames; 3974 var mangledGlobalNames = init.mangledGlobalNames;
3971 var hasOwnProperty = Object.prototype.hasOwnProperty; 3975 var hasOwnProperty = Object.prototype.hasOwnProperty;
3972 var length = reflectionData.length; 3976 var length = reflectionData.length;
3973 for (var i = 0; i < length; i++) { 3977 for (var i = 0; i < length; i++) {
3974 var data = reflectionData[i]; 3978 var data = reflectionData[i];
3975 var name = data[0]; 3979 var name = data[0];
3976 var uri = data[1]; 3980 var uri = data[1];
3977 var metadata = data[2]; 3981 var metadata = data[2];
3978 var descriptor = data[3]; 3982 var descriptor = data[3];
3983 var isRoot = !!data[4];
kustermann 2013/07/25 14:56:45 I guess this double negation is because the last p
ahe 2013/07/25 18:01:01 Yes. We use it so frequently in dart2js that we do
3979 var fields = descriptor && descriptor[""]; 3984 var fields = descriptor && descriptor[""];
3980 var classes = []; 3985 var classes = [];
3981 var functions = []; 3986 var functions = [];
3982 function processStatics(descriptor) { 3987 function processStatics(descriptor) {
3983 for (var property in descriptor) { 3988 for (var property in descriptor) {
3984 if (!hasOwnProperty.call(descriptor, property)) continue; 3989 if (!hasOwnProperty.call(descriptor, property)) continue;
3985 if (property === "") continue; 3990 if (property === "") continue;
3986 var element = descriptor[property]; 3991 var element = descriptor[property];
3987 var firstChar = property.substring(0, 1); 3992 var firstChar = property.substring(0, 1);
3988 var previousProperty; 3993 var previousProperty;
(...skipping 21 matching lines...) Expand all
4010 } else { 4015 } else {
4011 newDesc[previousProp = prop] = element[prop]; 4016 newDesc[previousProp = prop] = element[prop];
4012 } 4017 }
4013 } 4018 }
4014 $classesCollector[property] = newDesc; 4019 $classesCollector[property] = newDesc;
4015 classes.push(property); 4020 classes.push(property);
4016 } 4021 }
4017 } 4022 }
4018 } 4023 }
4019 processStatics(descriptor); 4024 processStatics(descriptor);
4020 libraries.push([name, uri, classes, functions, metadata, fields]); 4025 libraries.push([name, uri, classes, functions, metadata, fields, isRoot]);
4021 } 4026 }
4022 })'''; 4027 })''';
4023 } 4028 }
4024 } 4029 }
4025 4030
4026 const String GENERATED_BY = """ 4031 const String GENERATED_BY = """
4027 // Generated by dart2js, the Dart to JavaScript compiler. 4032 // Generated by dart2js, the Dart to JavaScript compiler.
4028 """; 4033 """;
4029 4034
4030 const String HOOKS_API_USAGE = """ 4035 const String HOOKS_API_USAGE = """
4031 // The code supports the following hooks: 4036 // The code supports the following hooks:
4032 // dartPrint(message) - if this function is defined it is called 4037 // dartPrint(message) - if this function is defined it is called
4033 // instead of the Dart [print] method. 4038 // instead of the Dart [print] method.
4034 // dartMainRunner(main) - if this function is defined, the Dart [main] 4039 // dartMainRunner(main) - if this function is defined, the Dart [main]
4035 // method will not be invoked directly. 4040 // method will not be invoked directly.
4036 // Instead, a closure that will invoke [main] is 4041 // Instead, a closure that will invoke [main] is
4037 // passed to [dartMainRunner]. 4042 // passed to [dartMainRunner].
4038 """; 4043 """;
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/lib/js_mirrors.dart » ('j') | dart/sdk/lib/_internal/lib/js_mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698