I tried to write my own json to dart class generator but when importing Parser class I got typeerror posted below. I asked on gitter but was told to make an issue.
I also uploaded my project since it will be easier and I want to make it public. Here's the link: https://github.com/charafau/json2builtvalue
dart --version)require.js:143 Uncaught TypeError: Cannot set property partName of class IdentifierContext extends core.Object {
get inDeclaration() {
return this[inDeclaration$0];
...<omitted>... } which has only a getter
at identifier_context_impl.dart:567
at Object.execCb (require.js:1696)
at Module.check (require.js:878)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.enable (require.js:1176)
at Module.init (require.js:788)
at callGetModule (require.js:1203)
at Object.completeLoad (require.js:1590)
at HTMLScriptElement.onScriptLoad (require.js:1717)
OK I think I understand this issue. I _think_ you're trying to compile dart_style with DDC, and it breaks. Unfortunately this error could be a lot better (or not a runtime error at all), but I'll defer to @jakemac53 or @jmesserly here.
@jakemac53 or @natebosch if this should be moved into build LMK.
This is a compiler bug in DDC. partName is used as a constant on IdentifierContext but it is shadowed by a constructor with the same name on LibraryIdentifierContext (which inherits from IdentifierContext).
Not sure the time table for fixing this. It's not too hard to fix in the current implementation, but I already have a big CL that fixes this (along with a bunch of other fixes/performance improvements). That big CL is going to take a bit longer to finish though.
What I'd suggest in the meantime is using dart2js, it should work for compiling all of our compilers.
Or if you can, maybe write a command line interface for you tool under bin, and use that with the Dart VM for testing?
Thank you guys, I will use dart2js then to finish it. As for console project, I have a tests which shows that it's working for console stuff. I will monitor this issue and hope it will be fixed soon.
Thank you
I confirm that it works with dart2js
@jmesserly is this still an issue? Somebody linked it recently in gitter https://gitter.im/dart-lang/sdk?at=5c52671713a2814df6f4ec5e
This seems to have been fixed, yes. Perhaps there's a similar issue with a different repro. I'll ask on the chat.
edit: the fix is that we're a lot more careful about using "defineValue(obj, prop)" now rather than "obj.prop = ..." pattern. This case works fine now:
class C {
static const int foo = 42;
}
class D extends C {
D.foo(x) { print('D.foo($x)'); }
}
main() {
new D.foo(123);
print(C.foo);
}