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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 1060813008: Handle symbol literals (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Add comment Created 5 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 unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.js_codegen; 5 library dev_compiler.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet, HashMap; 7 import 'dart:collection' show HashSet, HashMap;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 @override 2046 @override
2047 visitIntegerLiteral(IntegerLiteral node) => js.number(node.value); 2047 visitIntegerLiteral(IntegerLiteral node) => js.number(node.value);
2048 2048
2049 @override 2049 @override
2050 visitDoubleLiteral(DoubleLiteral node) => js.number(node.value); 2050 visitDoubleLiteral(DoubleLiteral node) => js.number(node.value);
2051 2051
2052 @override 2052 @override
2053 visitNullLiteral(NullLiteral node) => new JS.LiteralNull(); 2053 visitNullLiteral(NullLiteral node) => new JS.LiteralNull();
2054 2054
2055 @override 2055 @override
2056 visitSymbolLiteral(SymbolLiteral node) {
2057 // TODO(vsm): When we canonicalize, we need to treat private symbols
2058 // correctly.
2059 // TODO(vsm): Make this core.Symbol instead.
2060 var name = js.escapedString(node.components.join('.'));
2061 var symbol = js.call('new _internal.Symbol(#)', name);
2062 return js.commentExpression('Unimplemented const', symbol);
2063 }
2064
2065 @override
2056 visitListLiteral(ListLiteral node) { 2066 visitListLiteral(ListLiteral node) {
2057 JS.Expression list = new JS.ArrayInitializer(_visitList(node.elements)); 2067 JS.Expression list = new JS.ArrayInitializer(_visitList(node.elements));
2058 2068
2059 ParameterizedType type = node.staticType; 2069 ParameterizedType type = node.staticType;
2060 if (type.typeArguments.any((a) => a != types.dynamicType)) { 2070 if (type.typeArguments.any((a) => a != types.dynamicType)) {
2061 list = js.call('dart.setType(#, #)', [list, _emitTypeName(type)]); 2071 list = js.call('dart.setType(#, #)', [list, _emitTypeName(type)]);
2062 } 2072 }
2063 if (node.constKeyword != null) { 2073 if (node.constKeyword != null) {
2064 list = js.commentExpression('Unimplemented const', list); 2074 list = js.commentExpression('Unimplemented const', list);
2065 } 2075 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 return filepath; 2394 return filepath;
2385 } 2395 }
2386 2396
2387 // TODO(jmesserly): validate the library. See issue #135. 2397 // TODO(jmesserly): validate the library. See issue #135.
2388 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; 2398 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName';
2389 2399
2390 // TODO(jacobr): we would like to do something like the following 2400 // TODO(jacobr): we would like to do something like the following
2391 // but we don't have summary support yet. 2401 // but we don't have summary support yet.
2392 // bool _supportJsExtensionMethod(AnnotatedNode node) => 2402 // bool _supportJsExtensionMethod(AnnotatedNode node) =>
2393 // _getAnnotation(node, "SupportJsExtensionMethod") != null; 2403 // _getAnnotation(node, "SupportJsExtensionMethod") != null;
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698