Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart |
| index 2a05f19afaf092b987118ba4b74b7638442b1a66..5662614aa1a2eb34cac91eda387fa0f9fba4963c 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart |
| @@ -46,7 +46,7 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| '''; |
| String processStatics = ''' |
| - function processStatics(descriptor) { |
| + function processStatics(descriptor, isLibrary) { |
| for (var property in descriptor) { |
| if (!hasOwnProperty.call(descriptor, property)) continue; |
| if (property === "${namer.classDescriptorProperty}") continue; |
| @@ -72,11 +72,11 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| optionalMethods[property] = previousProperty; |
| } else if (typeof element === "function") { |
| globalObject[previousProperty = property] = element; |
| - functions.push(property); |
| - init.globalFunctions[property] = element; |
| + if (isLibrary) functions.push(property); |
| + init.staticFunctions[property] = element; |
| } else if (element.constructor === Array) { |
| addStubs(globalObject, element, property, |
| - true, descriptor, functions); |
| + true, descriptor, isLibrary ? functions : []); |
| } else { |
| previousProperty = property; |
| var newDesc = {}; |
| @@ -85,7 +85,7 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| if (!hasOwnProperty.call(element, prop)) continue; |
| firstChar = prop.substring(0, 1); |
| if (prop === "static") { |
| - processStatics(init.statics[property] = element[prop]); |
| + processStatics(init.statics[property] = element[prop], false); |
| } else if (firstChar === "+") { |
| mangledNames[previousProp] = prop.substring(1); |
| var flag = element[prop]; |
| @@ -166,7 +166,7 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| descriptor[name].\$getter = f; |
| f.\$getterStub = true; |
| // Used to create an isolate using spawnFunction. |
| - if (isStatic) init.globalFunctions[name] = f; |
| + if (isStatic) init.staticFunctions[name] = f; |
| originalDescriptor[getterStubName] = descriptor[getterStubName] = f; |
| funcs.push(f); |
| if (getterStubName) functions.push(getterStubName); |
| @@ -211,7 +211,9 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| if (!init.mangledGlobalNames) init.mangledGlobalNames = map(); |
| if (!init.statics) init.statics = map(); |
| if (!init.typeInformation) init.typeInformation = map(); |
| - if (!init.globalFunctions) init.globalFunctions = map(); |
| + // staticFunctions contains all static functions (global or not). This is used |
| + // when spawning isolates. |
| + if (!init.staticFunctions) init.staticFunctions = map(); |
|
ahe
2014/08/04 09:19:40
At first, this change put me off. Then I checked t
|
| if (!init.interceptedNames) init.interceptedNames = map(); |
| var libraries = init.libraries; |
| var mangledNames = init.mangledNames; |
| @@ -242,7 +244,7 @@ jsAst.Expression getReflectionDataParser(String classesCollector, |
| if (fields instanceof Array) fields = fields[0]; |
| var classes = []; |
| var functions = []; |
| - processStatics(descriptor); |
| + processStatics(descriptor, true); |
| libraries.push([name, uri, classes, functions, metadata, fields, isRoot, |
| globalObject]); |
| } |