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

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

Issue 973433003: Initial cut for a development server (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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 1f69fefc77ace646444ca3f6ddc6c8f4f11fbdbb..10b2742a35ec6f1e10dc55e4c5c31cda4c6f21a7 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -14,7 +14,6 @@ import 'package:analyzer/src/generated/scanner.dart'
show StringToken, Token, TokenType;
import 'package:source_maps/source_maps.dart' as srcmaps show Printer;
import 'package:source_maps/source_maps.dart' show SourceMapSpan;
-import 'package:source_span/source_span.dart' show SourceLocation;
import 'package:path/path.dart' as path;
// TODO(jmesserly): import from its own package
@@ -973,7 +972,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
// TODO(jmesserly): use a dummy setter to indicate writable.
if (!node.isFinal) {
methods.add(new JS.Method(
- new JS.PropertyName(name), js.call('function() {}'),
+ new JS.PropertyName(name), js.call('function(_) {}'),
Siggi Cherem (dart-lang) 2015/03/03 01:34:14 @jmesserly - I thought this change to remove the a
Jennifer Messerly 2015/03/03 02:24:21 yeah, seems that 1 arg is required for the setter
isSetter: true));
}
}
@@ -1786,26 +1785,18 @@ class SourceMapPrintingContext extends JS.JavaScriptPrintingContext {
}
if (unit == null || node == null || node.offset == -1) return;
- var loc = _location(node.offset);
+ var loc = locationFor(unit, uri, node.offset);
var name = _getIdentifier(node);
if (name != null) {
// TODO(jmesserly): mark only uses the beginning of the span, but
// we're required to pass this as a valid span.
- var end = _location(node.end);
+ var end = locationFor(unit, uri, node.end);
printer.mark(new SourceMapSpan(loc, end, name, isIdentifier: true));
} else {
printer.mark(loc);
}
}
- SourceLocation _location(int offset) {
Jennifer Messerly 2015/03/03 02:24:21 seems worth keeping this, but simplify impl? _loc
Siggi Cherem (dart-lang) 2015/03/04 04:44:23 Done.
- var lineInfo = unit.lineInfo.getLocation(offset);
- return new SourceLocation(offset,
- sourceUrl: uri,
- line: lineInfo.lineNumber - 1,
- column: lineInfo.columnNumber - 1);
- }
-
Uri _makeRelativeUri(Uri src) {
return new Uri(path: path.relative(src.path, from: outputDir));
}
@@ -1820,7 +1811,7 @@ class SourceMapPrintingContext extends JS.JavaScriptPrintingContext {
if (unit == null || node == null || node.offset == -1) return;
// TODO(jmesserly): in many cases marking the end will be unncessary.
- printer.mark(_location(node.end));
+ printer.mark(locationFor(unit, uri, node.end));
}
String _getIdentifier(AstNode node) {

Powered by Google App Engine
This is Rietveld 408576698