Closed HXiaoMing closed 9 months ago
Just use this.someNumber
Just use
this.someNumber
只需使用this.someNumber
use this.someNumber can solve it, but use someNumber can not work? sometime use this.someNumber, it will occur warning, such as Unnecessary 'this.' qualifier. Try removing 'this.'.
use this.someNumber can solve it, but use someNumber can not work? sometime use this.someNumber, it will occur warning, such as Unnecessary 'this.' qualifier. Try removing 'this.'.
You are getting the warning because dart's compiler is able to compile field references without the use of this keyword so it asks you to remove it for "cleaner code". You can turn off the warning from the analysis options file in your project.
use this.someNumber can solve it, but use someNumber can not work? sometime use this.someNumber, it will occur warning, such as Unnecessary 'this.' qualifier. Try removing 'this.'.用this.someNumber可以解决,但是用someNumber就不行了?有时使用 this.someNumber,它会出现警告,例如不必要的“this.”限定符。尝试删除“this.”。
You are getting the warning because dart's compiler is able to compile field references without the use of this keyword so it asks you to remove it for "cleaner code".您收到警告是因为 dart 的编译器能够在不使用此关键字的情况下编译字段引用,因此它要求您将其删除以获得“更干净的代码”。 You can turn off the warning from the analysis options file in your project.您可以从项目中的分析选项文件关闭警告。
It's better that both someNumber and this.someNumber work well.
Fixed in v0.7.5 (you don't have to use this
anymore)
change the test 'Using a subclassed bridge class inside the runtime' source code, will occur CompileError.
before change:
after change (I want to use super class field someNumber) :
and then run the 'Using a subclassed bridge class inside the runtime' test. it will occur CompileError Could not find declaration "someNumber".
package:dart_eval/src/eval/compiler/reference.dart 323:10 IdentifierReference.getValue package:dart_eval/src/eval/compiler/expression/identifier.dart 13:48 compileIdentifier package:dart_eval/src/eval/compiler/expression/expression.dart 36:12 compileExpression package:dart_eval/src/eval/compiler/expression/binary.dart 24:11 compileBinaryExpression package:dart_eval/src/eval/compiler/expression/expression.dart 40:12 compileExpression package:dart_eval/src/eval/compiler/helpers/argument_list.dart 340:18 compileArgumentListWithBridge package:dart_eval/src/eval/compiler/expression/method_invocation.dart 269:9 _invokeWithTarget package:dart_eval/src/eval/compiler/expression/method_invocation.dart 55:12 compileMethodInvocation package:dart_eval/src/eval/compiler/expression/expression.dart 38:12 compileExpression package:dart_eval/src/eval/compiler/statement/return.dart 24:9 compileReturn package:dart_eval/src/eval/compiler/statement/statement.dart 31:12 compileStatement package:dart_eval/src/eval/compiler/statement/block.dart 17:20 compileBlock package:dart_eval/src/eval/compiler/declaration/method.dart 56:14 compileMethodDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 21:12 compileDeclaration package:dart_eval/src/eval/compiler/declaration/class.dart 47:5 compileClassDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 17:5 compileDeclaration package:dart_eval/src/eval/compiler/compiler.dart 492:11 Compiler.compileSources..
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 481:15 Compiler.compileSources.
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 477:32 Compiler.compileSources
package:dart_eval/src/eval/compiler/compiler.dart 164:12 Compiler.compile
test/bridge_test.dart 47:32 main..
CompileError: Could not find declaration "someNumber" at unknown (file package:example/main.dart)
'Using a subclassed bridge class inside the runtime' test source code: