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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1050723002: partially implement instance of checks and some codegen fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index 223686983c0d3fd4a64cab8b0f247661723a61dc..4463878050e54f507c1b7855ca3ba9f158c41b65 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -145,7 +145,11 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
// TODO(jmesserly): this is a temporary workaround for `Symbol` in core,
// until we have better name tracking.
- String get _SYMBOL => currentLibrary.isDartCore ? 'dart.JsSymbol' : 'Symbol';
+ String get _SYMBOL {
+ var name = currentLibrary.name;
+ if (name == 'dart.core' || name == 'dart._internal') return 'dart.JsSymbol';
+ return 'Symbol';
+ }
@override
JS.Statement visitCompilationUnit(CompilationUnit node) {
@@ -1354,7 +1358,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
@override
visitConstructorName(ConstructorName node) {
- var typeName = _visit(node.type.name);
+ var typeName = _visit(node.type);
if (node.name != null) {
return js.call(
'#.#', [typeName, _jsMemberName(node.name.name, isStatic: true)]);
@@ -1870,6 +1874,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
// Discard following clauses, if any, as they are unreachable.
if (clause.exceptionType == null) return then;
+ // TODO(jmesserly): this doesn't seem like it will work for JS primtive
Jennifer Messerly 2015/04/01 00:32:35 this comment is a bit outdated (dart.is should wor
+ // types, see [visitIsExpression].
return new JS.If(js.call('dart.is(#, #)', [
_visit(_catchParameter),
_emitTypeName(clause.exceptionType.type),

Powered by Google App Engine
This is Rietveld 408576698