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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart

Issue 13704004: dart2js: Use js('source') instead of js['source'] to invoke JS mini-parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
index 41ec3e8f62065d2909efb5b5e478b77a053b943f..157645401a9d8f3a43fd636c0336c93b9452f635 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
@@ -15,7 +15,7 @@ class CodeEmitterNoEvalTask extends CodeEmitterTask {
void emitSuper(String superName, ClassBuilder builder) {
if (superName != '') {
- builder.addProperty('super', js.string(superName));
+ builder.addProperty('super', jsBuilder.string(superName));
}
}
@@ -66,31 +66,31 @@ class CodeEmitterNoEvalTask extends CodeEmitterTask {
List get defineClassFunction {
return [new jsAst.FunctionDeclaration(
new jsAst.VariableDeclaration('defineClass'),
- js.fun(['cls', 'constructor', 'prototype'],
- [js[r'constructor.prototype = prototype'],
- js[r'constructor.builtin$cls = cls'],
- js.return_('constructor')]))];
+ jsBuilder.fun(['cls', 'constructor', 'prototype'],
+ [js(r'constructor.prototype = prototype'),
+ js(r'constructor.builtin$cls = cls'),
+ jsBuilder.return_('constructor')]))];
}
List buildProtoSupportCheck() {
// We don't modify the prototypes in CSP mode. Therefore we can have an
// easier prototype-check.
- return [js['var $supportsProtoName = !(!({}.__proto__))']];
+ return [js('var $supportsProtoName = !(!({}.__proto__))')];
}
jsAst.Expression buildConstructor(String mangledName,
List<String> fieldNames) {
return new jsAst.NamedFunction(
new jsAst.VariableDeclaration(mangledName),
- js.fun(fieldNames, fieldNames.map(
- (name) => js['this.$name = $name']).toList()));
+ jsBuilder.fun(fieldNames, fieldNames.map(
+ (name) => js('this.$name = $name')).toList()));
}
jsAst.Expression buildUnusedConstructor(String mangledName) {
String message = 'Called unused constructor';
return new jsAst.NamedFunction(
new jsAst.VariableDeclaration(mangledName),
- js.fun([], new jsAst.Throw(js.string(message))));
+ jsBuilder.fun([], new jsAst.Throw(jsBuilder.string(message))));
}
jsAst.FunctionDeclaration get generateAccessorFunction {
@@ -98,13 +98,13 @@ class CodeEmitterNoEvalTask extends CodeEmitterTask {
'Internal error: no dynamic generation of accessors allowed.';
return new jsAst.FunctionDeclaration(
new jsAst.VariableDeclaration('generateAccessor'),
- js.fun([], new jsAst.Throw(js.string(message))));
+ jsBuilder.fun([], new jsAst.Throw(jsBuilder.string(message))));
}
jsAst.Expression buildLazyInitializedGetter(VariableElement element) {
String isolate = namer.CURRENT_ISOLATE;
String name = namer.getName(element);
- return js.fun([], js.return_(js['$isolate.$name']));
+ return jsBuilder.fun([], jsBuilder.return_(js('$isolate.$name')));
}
jsAst.Fun get lazyInitializerFunction {
@@ -112,7 +112,7 @@ class CodeEmitterNoEvalTask extends CodeEmitterTask {
// getterName, lazyValue, getter) {
var parameters = <String>['prototype', 'staticName', 'fieldName',
'getterName', 'lazyValue', 'getter'];
- return js.fun(parameters, addLazyInitializerLogic());
+ return jsBuilder.fun(parameters, addLazyInitializerLogic());
}
jsAst.Fun get finishIsolateConstructorFunction {
@@ -121,26 +121,27 @@ class CodeEmitterNoEvalTask extends CodeEmitterTask {
//
// We also copy over old values like the prototype, and the
// isolateProperties themselves.
- return js.fun('oldIsolate', [
- js['var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'],
+ return jsBuilder.fun('oldIsolate', [
+ js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'),
new jsAst.FunctionDeclaration(
new jsAst.VariableDeclaration('Isolate'),
- js.fun([], [
- js['var hasOwnProperty = Object.prototype.hasOwnProperty'],
- js.forIn('staticName', 'isolateProperties',
- js.if_('hasOwnProperty.call(isolateProperties, staticName)',
- js['this[staticName] = isolateProperties[staticName]'])),
+ jsBuilder.fun([], [
+ js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
+ jsBuilder.forIn('staticName', 'isolateProperties',
+ jsBuilder.if_(
+ 'hasOwnProperty.call(isolateProperties, staticName)',
+ js('this[staticName] = isolateProperties[staticName]'))),
// Use the newly created object as prototype. In Chrome,
// this creates a hidden class for the object and makes
// sure it is fast to access.
new jsAst.FunctionDeclaration(
new jsAst.VariableDeclaration('ForceEfficientMap'),
- js.fun([], [])),
- js['ForceEfficientMap.prototype = this'],
- js['new ForceEfficientMap()']])),
- js['Isolate.prototype = oldIsolate.prototype'],
- js['Isolate.prototype.constructor = Isolate'],
- js['Isolate.${namer.isolatePropertiesName} = isolateProperties'],
- js.return_('Isolate')]);
+ jsBuilder.fun([], [])),
+ js('ForceEfficientMap.prototype = this'),
+ js('new ForceEfficientMap()')])),
+ js('Isolate.prototype = oldIsolate.prototype'),
+ js('Isolate.prototype.constructor = Isolate'),
+ js('Isolate.${namer.isolatePropertiesName} = isolateProperties'),
+ jsBuilder.return_('Isolate')]);
}
}

Powered by Google App Engine
This is Rietveld 408576698